From b8bef557c04ed9be5ed7c980a1bd89fa9fcefe5f Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:41:27 +0000 Subject: [PATCH 1/9] Tag commits on NPM releases with pkgname-v.x.y.z --- .github/workflows/releases.yml | 30 +++++++++++++++++++- .github/workflows/tag-test.yml | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tag-test.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 51649a3e..e35b1985 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -9,11 +9,17 @@ on: jobs: test: + outputs: + sha: ${{ steps.commit.outputs.sha }} + tag: ${{ steps.tag.outputs.tag }} runs-on: macos-latest - steps: - name: setup repo uses: actions/checkout@v3 + - id: commit + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - id: tag + run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/tool-cache/package.json | jq .version)" >> "$GITHUB_OUTPUT" - name: verify package exists run: ls packages/${{ github.event.inputs.package }} @@ -77,4 +83,26 @@ jobs: curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK env: SLACK_WEBHOOK: ${{ secrets.SLACK }} + tag: + name: "Tag commit with ${{ github.event.inputs.package }}-version" + runs-on: "macos-latest" + needs: [test, publish] + steps: + - uses: actions/checkout@v3 + - name: Create tag + uses: actions/github-script@v6 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ needs.test.outputs.tag }}', + sha: '${{ needs.test.outputs.sha }}' + }) + - name: notify slack on failure + if: failure() + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK + env: + SLACK_WEBHOOK: ${{ secrets.SLACK }} diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml new file mode 100644 index 00000000..737627d0 --- /dev/null +++ b/.github/workflows/tag-test.yml @@ -0,0 +1,51 @@ +name: Tag test + +on: + workflow_dispatch: + inputs: + package: + required: true + description: 'core, artifact, cache, exec, github, glob, http-client, io, tool-cache' + +jobs: + test: + outputs: + sha: ${{ steps.commit.outputs.sha }} + tag: ${{ steps.tag.outputs.tag }} + runs-on: macos-latest + steps: + - name: setup repo + uses: actions/checkout@v3 + - id: commit + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - id: tag + run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/tool-cache/package.json | jq .version)" >> "$GITHUB_OUTPUT" + publish: + runs-on: macos-latest + needs: test + steps: + - name: foo + run: echo "foo" + tag: + name: "Tag commit with ${{ github.event.inputs.package }}-version" + runs-on: "macos-latest" + needs: [test, publish] + steps: + - uses: actions/checkout@v3 + - name: Create tag + uses: actions/github-script@v6 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ needs.test.outputs.tag }}', + sha: '${{ needs.test.outputs.sha }}' + }) + - name: notify slack on failure + # if: failure() + # run: | + # curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK + # env: + # SLACK_WEBHOOK: ${{ secrets.SLACK }} + From 4166af5b3ebcfc3ef8d182204eb71ea615542292 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:43:17 +0000 Subject: [PATCH 2/9] Fix typo --- .github/workflows/tag-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml index 737627d0..e6d68374 100644 --- a/.github/workflows/tag-test.yml +++ b/.github/workflows/tag-test.yml @@ -42,7 +42,7 @@ jobs: ref: 'refs/tags/${{ needs.test.outputs.tag }}', sha: '${{ needs.test.outputs.sha }}' }) - - name: notify slack on failure + # - name: notify slack on failure # if: failure() # run: | # curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK From 39e91a437aed1042e7ad9f8b0f7f87394a66a525 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:44:40 +0000 Subject: [PATCH 3/9] Fix indent --- .github/workflows/releases.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index e35b1985..928ba423 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -100,9 +100,9 @@ jobs: sha: '${{ needs.test.outputs.sha }}' }) - name: notify slack on failure - if: failure() - run: | - curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK - env: - SLACK_WEBHOOK: ${{ secrets.SLACK }} + if: failure() + run: | + curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK + env: + SLACK_WEBHOOK: ${{ secrets.SLACK }} From b92588fa7f29b3d347986da3ed17f9113b40703d Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:49:25 +0000 Subject: [PATCH 4/9] Use constants and push for tag-test Fix typo in releases.yml --- .github/workflows/releases.yml | 2 +- .github/workflows/tag-test.yml | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 928ba423..c87bc86c 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -19,7 +19,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/tool-cache/package.json | jq .version)" >> "$GITHUB_OUTPUT" + run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/${{ github.event.inputs.package }}/package.json | jq .version)" >> "$GITHUB_OUTPUT" - name: verify package exists run: ls packages/${{ github.event.inputs.package }} diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml index e6d68374..5fde93d4 100644 --- a/.github/workflows/tag-test.yml +++ b/.github/workflows/tag-test.yml @@ -1,11 +1,6 @@ name: Tag test -on: - workflow_dispatch: - inputs: - package: - required: true - description: 'core, artifact, cache, exec, github, glob, http-client, io, tool-cache' +on: push jobs: test: @@ -19,15 +14,15 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/tool-cache/package.json | jq .version)" >> "$GITHUB_OUTPUT" + run: echo "tag=http-client-$(cat packages/http-client/package.json | jq .version)" >> "$GITHUB_OUTPUT" publish: runs-on: macos-latest needs: test steps: - - name: foo - run: echo "foo" + - name: skip publish + run: echo "skip publish" tag: - name: "Tag commit with ${{ github.event.inputs.package }}-version" + name: "Tag ${{ needs.test.outputs.sha }} with ${{ needs.test.outputs.tag }}" runs-on: "macos-latest" needs: [test, publish] steps: From 7edb0957cca41b584428fbaef291565067e96bbf Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 10:51:42 +0000 Subject: [PATCH 5/9] Fix indentation --- .github/workflows/releases.yml | 14 +++++++------- .github/workflows/tag-test.yml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c87bc86c..714bf6ee 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -92,13 +92,13 @@ jobs: - name: Create tag uses: actions/github-script@v6 with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/${{ needs.test.outputs.tag }}', - sha: '${{ needs.test.outputs.sha }}' - }) + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ needs.test.outputs.tag }}', + sha: '${{ needs.test.outputs.sha }}' + }) - name: notify slack on failure if: failure() run: | diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml index 5fde93d4..6bef89c7 100644 --- a/.github/workflows/tag-test.yml +++ b/.github/workflows/tag-test.yml @@ -30,13 +30,13 @@ jobs: - name: Create tag uses: actions/github-script@v6 with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/${{ needs.test.outputs.tag }}', - sha: '${{ needs.test.outputs.sha }}' - }) + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ needs.test.outputs.tag }}', + sha: '${{ needs.test.outputs.sha }}' + }) # - name: notify slack on failure # if: failure() # run: | From cb86beb23a09fca25c78cdd541d7ae380640fb92 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 11:05:52 +0000 Subject: [PATCH 6/9] BEtter tag format --- .github/workflows/releases.yml | 4 ++-- .github/workflows/tag-test.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 714bf6ee..b3c0362e 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -19,7 +19,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=${{ github.event.inputs.package }}-$(cat packages/${{ github.event.inputs.package }}/package.json | jq .version)" >> "$GITHUB_OUTPUT" + run: echo "tag=@actions/${{ github.event.inputs.package }}@$(cat packages/${{ github.event.inputs.package }}/package.json | jq .version)" >> "$GITHUB_OUTPUT" - name: verify package exists run: ls packages/${{ github.event.inputs.package }} @@ -84,7 +84,7 @@ jobs: env: SLACK_WEBHOOK: ${{ secrets.SLACK }} tag: - name: "Tag commit with ${{ github.event.inputs.package }}-version" + name: "Tag ${{ needs.test.outputs.sha }} with ${{ needs.test.outputs.tag }}" runs-on: "macos-latest" needs: [test, publish] steps: diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml index 6bef89c7..515eae99 100644 --- a/.github/workflows/tag-test.yml +++ b/.github/workflows/tag-test.yml @@ -14,7 +14,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=http-client-$(cat packages/http-client/package.json | jq .version)" >> "$GITHUB_OUTPUT" + run: echo "tag=@actions/http-client-$(cat packages/http-client/package.json | jq .version)-test-tag" >> "$GITHUB_OUTPUT" publish: runs-on: macos-latest needs: test From 0d44da2b87f9ed48ae889d15c6cc19667aa37ec0 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 11:11:44 +0000 Subject: [PATCH 7/9] Raw jq for actual version --- .github/workflows/releases.yml | 2 +- .github/workflows/tag-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index b3c0362e..6779b21a 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -19,7 +19,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=@actions/${{ github.event.inputs.package }}@$(cat packages/${{ github.event.inputs.package }}/package.json | jq .version)" >> "$GITHUB_OUTPUT" + run: echo "tag=@actions/${{ github.event.inputs.package }}@$(cat packages/${{ github.event.inputs.package }}/package.json | jq -r .version" >> "$GITHUB_OUTPUT" - name: verify package exists run: ls packages/${{ github.event.inputs.package }} diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml index 515eae99..018eda8c 100644 --- a/.github/workflows/tag-test.yml +++ b/.github/workflows/tag-test.yml @@ -14,7 +14,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=@actions/http-client-$(cat packages/http-client/package.json | jq .version)-test-tag" >> "$GITHUB_OUTPUT" + run: echo "tag=@actions/http-client@$(cat packages/http-client/package.json | jq -r .version)-test-tag" >> "$GITHUB_OUTPUT" publish: runs-on: macos-latest needs: test From 4419cadd68091b9e0b52e4c6d24bb766d77085c5 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 11:18:17 +0000 Subject: [PATCH 8/9] Fix release typo --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 6779b21a..65a6596b 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -19,7 +19,7 @@ jobs: - id: commit run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - id: tag - run: echo "tag=@actions/${{ github.event.inputs.package }}@$(cat packages/${{ github.event.inputs.package }}/package.json | jq -r .version" >> "$GITHUB_OUTPUT" + run: echo "tag=@actions/${{ github.event.inputs.package }}@$(cat packages/${{ github.event.inputs.package }}/package.json | jq -r .version)" >> "$GITHUB_OUTPUT" - name: verify package exists run: ls packages/${{ github.event.inputs.package }} From 95edd3418c1ce6e295945f964bbb3d3e9f894086 Mon Sep 17 00:00:00 2001 From: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> Date: Tue, 7 Mar 2023 11:18:28 +0000 Subject: [PATCH 9/9] Delete test yaml --- .github/workflows/tag-test.yml | 46 ---------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/tag-test.yml diff --git a/.github/workflows/tag-test.yml b/.github/workflows/tag-test.yml deleted file mode 100644 index 018eda8c..00000000 --- a/.github/workflows/tag-test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Tag test - -on: push - -jobs: - test: - outputs: - sha: ${{ steps.commit.outputs.sha }} - tag: ${{ steps.tag.outputs.tag }} - runs-on: macos-latest - steps: - - name: setup repo - uses: actions/checkout@v3 - - id: commit - run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - - id: tag - run: echo "tag=@actions/http-client@$(cat packages/http-client/package.json | jq -r .version)-test-tag" >> "$GITHUB_OUTPUT" - publish: - runs-on: macos-latest - needs: test - steps: - - name: skip publish - run: echo "skip publish" - tag: - name: "Tag ${{ needs.test.outputs.sha }} with ${{ needs.test.outputs.tag }}" - runs-on: "macos-latest" - needs: [test, publish] - steps: - - uses: actions/checkout@v3 - - name: Create tag - uses: actions/github-script@v6 - with: - script: | - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'refs/tags/${{ needs.test.outputs.tag }}', - sha: '${{ needs.test.outputs.sha }}' - }) - # - name: notify slack on failure - # if: failure() - # run: | - # curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Publish of ${{ github.event.inputs.package }} was successful, but failed to tag commit ${{ needs.test.outputs.sha }} with version ${{ needs.test.outputs.tag }}"}' $SLACK_WEBHOOK - # env: - # SLACK_WEBHOOK: ${{ secrets.SLACK }} -