From e74b929d98838b164b4e430eee79d4fdc1a73189 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Tue, 15 Oct 2024 17:28:38 +0200 Subject: [PATCH] add release-tag action --- .forgejo/workflows/release-tag/web.yaml | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .forgejo/workflows/release-tag/web.yaml diff --git a/.forgejo/workflows/release-tag/web.yaml b/.forgejo/workflows/release-tag/web.yaml new file mode 100644 index 0000000..dc9f8fe --- /dev/null +++ b/.forgejo/workflows/release-tag/web.yaml @@ -0,0 +1,62 @@ +on: + push: + tags: + - "ws-office-[0-9]+\\.[0-9]+\\.[0-9]+" + +jobs: + create-package: + runs-on: self-hosted + container: + image: catthehacker/ubuntu:act-latest + # options: "-v " + steps: + - name: Check out Repo + uses: https://code.forgejo.org/actions/checkout@v3 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + + - name: Connect to git2.workstreams.ch Docker registry + uses: https://github.com/docker/login-action@v2 + with: + registry: git2.workstreams.ch + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set RELEASE_TAG + run: | + release_tag="$GITHUB_RELEASE_TAG" + echo "RELEASE_TAG=$release_tag" >> $GITHUB_ENV + echo "the release tag will be '$release_tag'" + + - name: Set PRODUCT_VERSION and BUILD_NUMBER + run: | + export $(grep -v '^#' .env | xargs) + echo "PRODUCT_VERSION=$product_version" >> $GITHUB_ENV + echo "BUILD_NUMBER=$build_number" >> $GITHUB_ENV + + - name: Docker Build + uses: https://github.com/docker/build-push-action@v4 + env: + ACTIONS_RUNTIME_TOKEN: "" # See https://gitea.com/gitea/act_runner/issues/119 + with: + context: ./ + build-args: | + product_version=${{ env.PRODUCT_VERSION }} + build_number=${{ env.BUILD_NUMBER }} + file: ./Dockerfile + platforms: | + linux/amd64 + push: true + tags: | + git2.workstreams.ch/workstreams-os/ws-office-dev:${{ env.RELEASE_TAG }} + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + # - # Temp fix + # # https://github.com/docker/build-push-action/issues/252 + # # https://github.com/moby/buildkit/issues/1896 + # name: Move cache + # run: | + # rm -rf /tmp/.buildx-cache + # mv /tmp/.buildx-cache-new /tmp/.buildx-cache