From 395b5657cb9790d3ae18230266d04e36550623c5 Mon Sep 17 00:00:00 2001 From: Igor Abade Date: Sun, 13 Oct 2024 20:42:27 -0300 Subject: [PATCH] Update pipeline to move tag to main --- .github/workflows/main.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d8be1d5..7c0dba7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,8 @@ env: on: pull_request: branches: [ main ] + push: + branches: [ main ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,6 +20,7 @@ jobs: Build: runs-on: windows-latest + if: github.event_name == 'pull_request' env: TFSCMDLETS_ACCESS_TOKEN: ${{ secrets.TFSCMDLETS_TOKEN }} TFSCMDLETS_COLLECTION_URL: 'https://dev.azure.com/tfscmdlets' @@ -337,3 +340,23 @@ jobs: # with: # status: | # TfsCmdlets version ${{ env.BUILD_NAME }} has just been released. Check it out! https://github.com/igoravl/TfsCmdlets/releases/tag/v${{ env.RELEASE_TAG }} + + PostRelease: + + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Update tag + run: | + COMMIT_MESSAGE=$(git log -1 --pretty=%B) + if [[ "$COMMIT_MESSAGE" =~ \(\#[0-9]+\)$ ]]; then + LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + git tag -d $LATEST_TAG + git tag $LATEST_TAG $GITHUB_SHA + git push origin :refs/tags/$LATEST_TAG + git push origin $LATEST_TAG + fi \ No newline at end of file