Skip to content

Commit

Permalink
create a release and upload release assets
Browse files Browse the repository at this point in the history
  • Loading branch information
sheurich committed Mar 4, 2024
1 parent 62258b7 commit 8430897
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build Release
# Run on release publish events.
# Run on semver tags.
on:
release:
types:
- published
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: read
packages: write # Allow docker/build-push-action to publish to GitHub Container Registry
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
-v \
./cmd/${{ matrix.app }}
- name: Display ${{ matrix.app }} artifacts
run: ls -lR /tmp/dist
run: tree /tmp/dist
- name: Store ${{ matrix.app }} artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -71,7 +71,7 @@ jobs:
path: /tmp/dist
pattern: ${{ matrix.app }}-*-*
- name: Display ${{ matrix.app }} artifacts
run: ls -lR /tmp/dist
run: tree /tmp/dist
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand All @@ -83,8 +83,7 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=sha
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down Expand Up @@ -125,3 +124,35 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Display pebble version in container image
run: docker run ${{ env.DOCKER_IMAGE_BASENAME }}/pebble:latest -version
create-release:
needs:
- go-build
permissions:
contents: write # Allow creation of a release
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
- name: Display build artifacts
run: tree .
- name: Create release
# https://cli.github.com/manual/gh_release_create
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} \
--repo ${{ github.repository }} \
--title "${{ github.ref_name }}" \
--verify-tag
continue-on-error: true
- name: Upload release files
# https://cli.github.com/manual/gh_release_upload
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
for artifact in *; do
tar czf ${artifact}.tar.gz ${artifact}
zip -r ${artifact}.zip ${artifact}
gh release upload ${{ github.ref_name }} ${artifact}.* \
--repo ${{ github.repository }};
done

0 comments on commit 8430897

Please sign in to comment.