diff --git a/.github/actions/publish-server/action.yml b/.github/actions/publish-server/action.yml index a544386c6..56d666ceb 100644 --- a/.github/actions/publish-server/action.yml +++ b/.github/actions/publish-server/action.yml @@ -13,13 +13,13 @@ runs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ inputs.gh_token }} - + - name: Build Server shell: bash run: | cargo build --release -p server cp ./target/release/server ./apps/server/server - + - name: Determine image name & tag shell: bash run: | @@ -33,21 +33,28 @@ runs: echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV echo "Building $IMAGE_NAME:$IMAGE_TAG" - - name: Build & push Docker image + + - name: Build Docker image shell: bash run: | docker build ./apps/server --tag $IMAGE_NAME:$IMAGE_TAG + + - name: Push Docker image + shell: bash + if: github.event_name != 'pull_request' + run: | docker push $IMAGE_NAME:$IMAGE_TAG + - name: Tag & push image as latest staging image if: github.event_name != 'release' shell: bash run: | docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:staging docker push $IMAGE_NAME:staging - + - name: Tag & push image as latest production image if: github.event_name == 'release' shell: bash run: | docker tag $IMAGE_NAME:$IMAGE_TAG $IMAGE_NAME:production - docker push $IMAGE_NAME:production \ No newline at end of file + docker push $IMAGE_NAME:production diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a64a6929..7ed4371b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: components: rustfmt, rust-src - name: Cache Rust Dependencies - uses: brendonovich/rust-cache@v1 + uses: Swatinem/rust-cache@v1 with: key: ${{ matrix.platform }}-core-v1-${{ hashFiles('**/Cargo.lock') }} @@ -129,7 +129,7 @@ jobs: components: rustfmt, rust-src - name: Cache Rust Dependencies - uses: brendonovich/rust-cache@v1 + uses: Swatinem/rust-cache@v1 with: key: ${{ matrix.platform }}-core-v1-${{ hashFiles('**/Cargo.lock') }} @@ -154,11 +154,10 @@ jobs: - name: Publish artifacts uses: ./.github/actions/publish-desktop-artifacts - deploy-server: - name: Deploy server + build-server: + name: Build server runs-on: ubuntu-latest needs: build-core - if: github.event_name != 'pull_request' steps: - name: Checkout repository uses: actions/checkout@v2 @@ -175,7 +174,7 @@ jobs: components: rustfmt, rust-src - name: Cache Rust Dependencies - uses: brendonovich/rust-cache@v1 + uses: Swatinem/rust-cache@v1 with: key: ${{ matrix.platform }}-core-v1-${{ hashFiles('**/Cargo.lock') }} @@ -183,11 +182,17 @@ jobs: working-directory: core run: cargo run -p prisma-cli --release -- generate - - name: Build and publish server + - name: Build server uses: ./.github/actions/build-and-publish-server with: gh_token: ${{ secrets.GITHUB_TOKEN }} + deploy-server: + name: Deploy Server + runs-on: ubuntu-latest + needs: build-server + if: github.event_name != 'pull_request' + steps: - name: Deploy Spacedrive Server to Kubernetes env: K8S_KUBECONFIG: ${{ secrets.K8S_KUBECONFIG }}