diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml deleted file mode 100644 index 57dc6b8..0000000 --- a/.github/workflows/tag.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Create Tag - -on: - push: - branches: - # explicit deny all here to make sure there isnt a commit loop - - '!*' - - main - -jobs: - create_tag: - runs-on: ubuntu-latest - needs: run_tests - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: check if tag already exists - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* && git rev-parse "$(cat VERSION)" >/dev/null 2>&1 && exit 1 || exit 0 - - - name: create tag - run: git config --global user.email "${{ github.actor }}" && git config --global user.name "${{ github.actor }}" && git tag -a -m "$(cat VERSION)" $(cat VERSION) && git push --follow-tags diff --git a/.github/workflows/test.yml b/.github/workflows/test-tag.yml similarity index 81% rename from .github/workflows/test.yml rename to .github/workflows/test-tag.yml index d1da01f..86eb2bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-tag.yml @@ -1,4 +1,4 @@ -name: Run tests +name: Run tests, Tag release on: push: @@ -9,6 +9,19 @@ on: - fix/* jobs: + create_tag: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + needs: run_tests + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: check if tag already exists + run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* && git rev-parse "$(cat VERSION)" >/dev/null 2>&1 && exit 1 || exit 0 + + - name: create tag + run: git config --global user.email "${{ github.actor }}" && git config --global user.name "${{ github.actor }}" && git tag -a -m "$(cat VERSION)" $(cat VERSION) && git push --follow-tags run_tests: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 72f7778..6955fe1 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Action to commit a file/directory to another repo using a deploy key. * Add the private key to your source repo as a secret ```yaml -uses: leigholiver/commit-with-deploy-key@v1.0.0 +uses: leigholiver/commit-with-deploy-key@v1.0.2 with: source: build_output destination_folder: dist