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

View file

@ -8,27 +8,55 @@ on:
required: true required: true
jobs: jobs:
get-tag: create-tag:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
tag: ${{ steps.get_tag.outputs.tag }} tagname: ${{ steps.create_tag.outputs.tagname }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install Node.js - name: Create Tag
uses: actions/setup-node@v4 id: create_tag
uses: Klemensas/action-autotag@stable
with: 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 build-worker:
id: get_tag runs-on: ubuntu-latest
run: | needs: create-tag
VERSION=$(npm run version --silent) steps:
echo "tag=v${VERSION}-beta.${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT - 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: build-images:
needs: get-tag needs: create-tag
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
@ -51,15 +79,15 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64
push: true 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-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 cache-to: type=registry,ref=ghcr.io/${{ github.repository_owner }}/runtipi:buildcache,mode=max
build-cli: build-cli:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: get-tag needs: create-tag
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -93,7 +121,7 @@ jobs:
run: pnpm install run: pnpm install
- name: Set version - 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 - name: Build CLI
run: pnpm -r --filter cli package run: pnpm -r --filter cli package
@ -104,27 +132,9 @@ jobs:
name: cli name: cli
path: packages/cli/dist 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: publish-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [create-tag, build-images, build-cli] needs: [create-tag, build-images, build-cli, build-worker]
outputs: outputs:
id: ${{ steps.create_release.outputs.id }} id: ${{ steps.create_release.outputs.id }}
steps: steps: