feat(ci): arm builds, push multiple registries
Release-As: 0.13.0
This commit is contained in:
52
.github/workflows/release.yaml
vendored
52
.github/workflows/release.yaml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
- master
|
||||
jobs:
|
||||
release-please:
|
||||
name: Run release-please
|
||||
name: Run Release Please
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
release_created: ${{ steps.release.outputs.release_created }}
|
||||
@@ -13,33 +13,47 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup release please
|
||||
- name: Setup Release Please
|
||||
uses: google-github-actions/release-please-action@v2
|
||||
id: release
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
token: ${{ secrets.CR_PAT }}
|
||||
release-type: simple
|
||||
changelog-path: CHANGELOG.md
|
||||
package-name: gonic
|
||||
build-tag-publish:
|
||||
build-release:
|
||||
name: Build, tag, and publish Docker image
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
needs: release-please
|
||||
runs-on: ubuntu-latest
|
||||
needs: [release-please]
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Update version.go
|
||||
run: sed -Ei 's/VERSION = "v0.0.0"/VERSION = "${{ needs.release-please.outputs.tag_name }}"/g' version/version.go
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
version: latest
|
||||
driver-opts: image=moby/buildkit:master
|
||||
- name: Login into DockerHub
|
||||
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||
- name: Login into GitHub Container Registry
|
||||
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
|
||||
- name: Build Docker image
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
run: |
|
||||
docker build \
|
||||
-t "ghcr.io/${GITHUB_REPOSITORY}:${{ needs.release-please.outputs.tag_name }}" \
|
||||
-t "ghcr.io/${GITHUB_REPOSITORY}:latest" .
|
||||
- name: Release Docker image
|
||||
run: |
|
||||
docker push "ghcr.io/${GITHUB_REPOSITORY}:${{ needs.release-please.outputs.tag_name }}"
|
||||
docker push "ghcr.io/${GITHUB_REPOSITORY}:latest"
|
||||
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ needs.release-please.outputs.tag_name }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
${{ github.repository }}:${{ needs.release-please.outputs.tag_name }}
|
||||
${{ github.repository }}:latest
|
||||
|
||||
Reference in New Issue
Block a user