summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-05 04:33:57 +0900
committerGitHub <noreply@github.com>2023-07-05 04:33:57 +0900
commit9014c212e8e1f6cf536820646d848208db2f8174 (patch)
treeb5b205733b3ac9997d27cebf80e7d63728be4c57 /.github
parent886a9b18b10e4e31b8c746d1f243043d2b7ea234 (diff)
Release Docker image to GitHub Container Registry (#2652)
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml46
1 files changed, 41 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5974e177..d532109e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
@@ -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
@@ -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-*