From 445e8957258d26ee28609e34a14507636dcf63d2 Mon Sep 17 00:00:00 2001 From: Mogyuchi Date: Sat, 31 Aug 2024 11:10:59 +0900 Subject: [PATCH] ci: create tag --- .github/workflows/docker-publish.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 601acbe5d..373a7ffea 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -38,8 +38,28 @@ jobs: run: | echo "BINARY_NAME=$(cargo metadata --offline --no-deps --format-version=1 | jq -r '.packages[].targets[] | select(.kind | map(. == "bin") | any ) | .name')" >> $GITHUB_OUTPUT + create-tag: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - if: ${{ inputs.tag-name }} + name: Create tag + run: | + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "/repos/$OWNER_REPO/git/refs" \ + -f "ref=refs/tags/$TAG" -f "sha=$SHA" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER_REPO: ${{ github.repository }} + TAG: ${{ inputs.tag-name }} + SHA: ${{ github.sha }} + build: - needs: [env] + needs: [create-tag, env] permissions: contents: write packages: write