Skip to content

Commit

Permalink
Release Docker image to GitHub Container Registry (#2652)
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Jul 4, 2023
1 parent 886a9b1 commit 9014c21
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ jobs:

dist:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/jq-')
steps:
- name: Clone repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -217,12 +218,48 @@ jobs:
jq-*.tar.gz
jq-*.zip
docker:
runs-on: ubuntu-latest
permissions:
packages: write
if: startsWith(github.ref, 'refs/tags/jq-')
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true
- name: Docker metadata
uses: docker/metadata-action@v4
id: metadata
with:
images: ghcr.io/${{ github.repository }}
tags: type=match,pattern=jq-(.*),group=1,value=${{ github.ref_name }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and release Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
provenance: false
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [linux, macos, windows, dist]
if: startsWith(github.event.ref, 'refs/tags/jq-')
needs: [linux, macos, windows, dist, docker]
if: startsWith(github.ref, 'refs/tags/jq-')
steps:
- name: Clone repository
uses: actions/checkout@v3
Expand All @@ -240,6 +277,5 @@ jobs:
cp artifacts/jq-macos-macos-13-gcc/jq release/jq-macos-amd64
cp artifacts/jq-windows-windows-2022-gcc/jq.exe release/jq-windows-amd64.exe
cp artifacts/jq-dist/jq-* release/
gh release create $TAG_NAME --draft --title "jq ${TAG_NAME#jq-}" --generate-notes
gh release upload $TAG_NAME --clobber release/jq-*
gh release create "$TAG_NAME" --draft --title "jq ${TAG_NAME#jq-}" --generate-notes
gh release upload "$TAG_NAME" --clobber release/jq-*

0 comments on commit 9014c21

Please sign in to comment.