From a5edbc9ac44f04ebf428ede954efb1d64133d163 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 27 Apr 2023 12:08:41 +0800 Subject: [PATCH] Release docker images (#151) Did some tests to make sure it worked. See https://hub.docker.com/r/gitea/act_runner/tags Reviewed-on: https://gitea.com/gitea/act_runner/pulls/151 --- .gitea/workflows/build-image.yml | 46 -------------------------- .gitea/workflows/release-nightly.yml | 48 +++++++++++++++++++++++++++- .gitea/workflows/release-tag.yml | 47 ++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 48 deletions(-) delete mode 100644 .gitea/workflows/build-image.yml diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml deleted file mode 100644 index 5dfc522..0000000 --- a/.gitea/workflows/build-image.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build image -on: - push: - tags: - - v* -jobs: - build-image: - runs-on: ubuntu-latest - container: - image: catthehacker/ubuntu:act-latest - env: - DOCKER_USERNAME: gitea - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker BuildX - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ env.DOCKER_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Get Meta - id: meta - run: | - echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT - echo REPO_VERSION=$(echo ${{ github.ref }} | awk -F"/" '{print $3}' | awk -F"v" '{print $2}') >> $GITHUB_OUTPUT - - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - file: ./Dockerfile - platforms: | - linux/amd64 - linux/arm64 - push: true - tags: | - ${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:latest - ${{ env.DOCKER_USERNAME }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} diff --git a/.gitea/workflows/release-nightly.yml b/.gitea/workflows/release-nightly.yml index 92e878c..eccefba 100644 --- a/.gitea/workflows/release-nightly.yml +++ b/.gitea/workflows/release-nightly.yml @@ -1,4 +1,4 @@ -name: goreleaser +name: release-nightly on: push: @@ -45,3 +45,49 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} S3_REGION: ${{ secrets.AWS_REGION }} S3_BUCKET: ${{ secrets.AWS_BUCKET }} + release-image: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + env: + DOCKER_ORG: gitea + DOCKER_LATEST: nightly + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # all history for all branches and tags + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Meta + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always) >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v4 + env: + ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} + ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} + diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index e3c3d18..41df1ef 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -1,4 +1,4 @@ -name: goreleaser +name: release-tag on: push: @@ -56,3 +56,48 @@ jobs: GORELEASER_FORCE_TOKEN: 'gitea' GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + release-image: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + env: + DOCKER_ORG: gitea + DOCKER_LATEST: latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # all history for all branches and tags + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Meta + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always) >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v4 + env: + ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} + ${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}