ci(beta): adapt workflow with new worker build

This commit is contained in:
Nicolas Meienberger 2023-11-26 09:30:19 +01:00
parent 213b9ed482
commit 166d9b49f2
2 changed files with 44 additions and 36 deletions

View file

@ -59,7 +59,6 @@ jobs:
build-images:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -90,7 +89,6 @@ jobs:
build-cli:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Checkout code
uses: actions/checkout@v4

View file

@ -8,27 +8,55 @@ on:
required: true
jobs:
get-tag:
create-tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.get_tag.outputs.tag }}
tagname: ${{ steps.create_tag.outputs.tagname }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
- name: Create Tag
id: create_tag
uses: Klemensas/action-autotag@stable
with:
node-version: 18
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'
tag_suffix: '-beta.${{ github.event.inputs.tag }}'
- name: Get tag from VERSION file
id: get_tag
run: |
VERSION=$(npm run version --silent)
echo "tag=v${VERSION}-beta.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
build-worker:
runs-on: ubuntu-latest
needs: create-tag
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .
file: ./packages/worker/Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository_owner }}/worker:${{ needs.create-tag.outputs.tagname }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/worker:buildcache,mode=max
build-images:
needs: get-tag
needs: create-tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
@ -51,15 +79,15 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.get-tag.outputs.tag }}
tags: ghcr.io/${{ github.repository_owner }}/runtipi:${{ needs.create-tag.outputs.tagname }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max
build-cli:
runs-on: ubuntu-latest
needs: get-tag
needs: create-tag
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -93,7 +121,7 @@ jobs:
run: pnpm install
- name: Set version
run: pnpm -r --filter cli set-version ${{ needs.get-tag.outputs.tag }}
run: pnpm -r --filter cli set-version ${{ needs.create-tag.outputs.tagname }}
- name: Build CLI
run: pnpm -r --filter cli package
@ -104,27 +132,9 @@ jobs:
name: cli
path: packages/cli/dist
create-tag:
needs: [build-images, build-cli]
runs-on: ubuntu-latest
outputs:
tagname: ${{ steps.create_tag.outputs.tagname }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Tag
id: create_tag
uses: Klemensas/action-autotag@stable
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: 'v'
tag_suffix: '-beta.${{ github.event.inputs.tag }}'
publish-release:
runs-on: ubuntu-latest
needs: [create-tag, build-images, build-cli]
needs: [create-tag, build-images, build-cli, build-worker]
outputs:
id: ${{ steps.create_release.outputs.id }}
steps: