ci: use original cache action + build server

This commit is contained in:
Brendan Allan 2022-05-01 17:36:23 +08:00
parent 8e6f4f0f6f
commit 53b8b59569
2 changed files with 24 additions and 12 deletions

View file

@ -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
docker push $IMAGE_NAME:production

View file

@ -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 }}