|
7 | 7 |
|
8 | 8 | jobs:
|
9 | 9 | release:
|
10 |
| - name: Docker |
11 | 10 | runs-on: ubuntu-latest
|
12 | 11 | steps:
|
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: Fetch tags |
| 18 | + run: git fetch --force --tags |
| 19 | + |
13 | 20 | - name: Setup QEMU
|
14 |
| - uses: docker/setup-qemu-action@v1 |
| 21 | + uses: docker/setup-qemu-action@v2 |
15 | 22 |
|
16 | 23 | - name: Setup Docker Buildx
|
17 |
| - uses: docker/setup-buildx-action@v1 |
| 24 | + uses: docker/setup-buildx-action@v2 |
| 25 | + id: buildx |
18 | 26 |
|
19 |
| - - name: Check out code |
20 |
| - uses: actions/checkout@v2 |
| 27 | + - name: Login to container Registry |
| 28 | + uses: docker/login-action@v2 |
| 29 | + with: |
| 30 | + username: ${{ github.repository_owner }} |
| 31 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + registry: ghcr.io |
| 33 | + |
| 34 | + - name: Prepare |
| 35 | + id: prep |
| 36 | + run: | |
| 37 | + VERSION=sha-${GITHUB_SHA::8} |
| 38 | + if [[ $GITHUB_REF == refs/tags/* ]]; then |
| 39 | + VERSION=${GITHUB_REF/refs\/tags\//} |
| 40 | + fi |
| 41 | + echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ') |
| 42 | + echo ::set-output name=VERSION::${VERSION} |
| 43 | +
|
| 44 | + - name: Publish multi-arch Docker image |
| 45 | + uses: docker/build-push-action@v4 |
| 46 | + with: |
| 47 | + push: true |
| 48 | + builder: ${{ steps.buildx.outputs.name }} |
| 49 | + context: . |
| 50 | + file: ./Dockerfile |
| 51 | + platforms: linux/arm64,linux/amd64 |
| 52 | + tags: | |
| 53 | + ghcr.io/${{ github.repository_owner }}/bankroach:${{ steps.prep.outputs.VERSION }} |
| 54 | + ghcr.io/${{ github.repository_owner }}/bankroach:latest |
| 55 | + labels: | |
| 56 | + org.opencontainers.image.title=${{ github.event.repository.name }} |
| 57 | + org.opencontainers.image.description=${{ github.event.repository.description }} |
| 58 | + org.opencontainers.image.source=${{ github.event.repository.html_url }} |
| 59 | + org.opencontainers.image.url=${{ github.event.repository.html_url }} |
| 60 | + org.opencontainers.image.revision=${{ github.sha }} |
| 61 | + org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }} |
| 62 | + org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }} |
21 | 63 |
|
22 |
| - - name: Release |
| 64 | + - name: GoReleaser |
| 65 | + uses: goreleaser/goreleaser-action@v3 |
| 66 | + with: |
| 67 | + version: latest |
| 68 | + args: release |
23 | 69 | env:
|
24 |
| - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |
25 |
| - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |
26 |
| - run: ./scripts/release.sh |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments