ensure package release flow is picked up

Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
Avi Deitcher 2024-03-11 14:12:15 +02:00
parent 55963aa26f
commit 15730ea617
2 changed files with 8 additions and 16 deletions

View File

@ -1,15 +1,12 @@
name: Release a tag name: Release a tag
on: on:
workflow_run: create:
workflows: [LinuxKit CI]
types: [completed]
branches: [master, main]
jobs: jobs:
release: release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/pkg-v')
name: Release packages name: Release packages
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/pkg-v')
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go 1.21 - name: Set up Go 1.21
@ -21,23 +18,19 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Ensure bin/ directory - name: Ensure bin/ directory
run: mkdir -p bin run: mkdir -p bin
- name: Download linuxkit - name: Install linuxkit
run: run:
go build -o bin/linuxkit ./src/cmd/linuxkit go build -o bin/linuxkit ./src/cmd/linuxkit
sudo mv bin/linuxkit /usr/local/bin/ sudo mv bin/linuxkit /usr/local/bin/
- name: Restore Package Cache
uses: actions/cache@v3
with:
path: ~/.linuxkit/cache/
key: ${{ runner.os }}-linuxkit-${{ github.sha }}
restore-keys: |
${{ runner.os }}-linuxkit-
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish Packages as Release - name: Publish Packages as Release
# this should not build anything, as they all should be built already
# however, it can fail if we push the tag before the merge-to-master build is complete, since that may publish
# so *always* wait for any merge-to-master to complete before publishing pkg-v* tags
run: | run: |
RELEASE_TAG=${GITHUB_REF#refs/tags/pkg-} RELEASE_TAG=${GITHUB_REF#refs/tags/pkg-}
echo "RELEASE_TAG=${RELEASE_TAG}" echo "RELEASE_TAG=${RELEASE_TAG}"

View File

@ -2,13 +2,12 @@ name: Release a tag
on: on:
create: create:
tags:
- v*
jobs: jobs:
build: build:
name: Build all targets name: Build all targets
runs-on: macos-latest if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps: steps:
- name: Set up Go 1.19 - name: Set up Go 1.19