From 7027f39fea7d388dfa4077e40cf066c7a21bc651 Mon Sep 17 00:00:00 2001 From: TheDevMinerTV Date: Thu, 16 Mar 2023 12:35:20 +0100 Subject: [PATCH] fix: ci release pipeline --- .github/workflows/release.yml | 54 ++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 372dd2fb5..c018b0dbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,13 @@ name: Create GitHub release on: - release: - types: - - created + create: + tags: + - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: "${{ github.repository_owner }}/ofelia" jobs: release: @@ -17,8 +21,50 @@ jobs: uses: actions/checkout@v2 - name: Release binaries - uses: netresearch/go-release-action@master + uses: wangyoucao577/go-release-action@v1.36 with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.goos }} goarch: amd64 + + docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache docker layers + uses: actions/cache@v2.1.4 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ matrix.service }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-${{ matrix.service }} + ${{ runner.os }}-buildx- + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }} + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 + labels: | + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache +