From 671db9418b14651c2558f30d8d1c2b3da811f319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Su=C3=B1=C3=A9?= <39730064+josunefon@users.noreply.github.com> Date: Tue, 28 Jun 2022 17:53:03 +0200 Subject: [PATCH 1/2] Create PublishRelease.yml --- .github/workflows/PublishRelease.yml | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/PublishRelease.yml diff --git a/.github/workflows/PublishRelease.yml b/.github/workflows/PublishRelease.yml new file mode 100644 index 0000000..e8d47b5 --- /dev/null +++ b/.github/workflows/PublishRelease.yml @@ -0,0 +1,32 @@ +name: "Release" + +on: # yamllint disable-line rule:truthy + push: + tags: + - "**" + +jobs: + release: + name: "Release" + runs-on: "ubuntu-latest" + steps: + - name: "Determine tag" + run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" + - name: "Create release" + uses: "actions/github-script@v5" + with: + github-token: "${{ secrets.PAT }}" + script: | + try { + await github.rest.repos.createRelease({ + draft: false, + generate_release_notes: true, + name: process.env.RELEASE_TAG, + owner: context.repo.owner, + prerelease: false, + repo: context.repo.repo, + tag_name: process.env.RELEASE_TAG, + }); + } catch (error) { + core.setFailed(error.message); + } From 6c50fcf82017fb628a4a67096fb26fe6a85cd0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jordi=20Su=C3=B1=C3=A9?= <39730064+josunefon@users.noreply.github.com> Date: Tue, 28 Jun 2022 19:04:23 +0200 Subject: [PATCH 2/2] Update and rename PublishRelease.yml to publish-release.yml --- .../workflows/{PublishRelease.yml => publish-release.yml} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename .github/workflows/{PublishRelease.yml => publish-release.yml} (79%) diff --git a/.github/workflows/PublishRelease.yml b/.github/workflows/publish-release.yml similarity index 79% rename from .github/workflows/PublishRelease.yml rename to .github/workflows/publish-release.yml index e8d47b5..ce85771 100644 --- a/.github/workflows/PublishRelease.yml +++ b/.github/workflows/publish-release.yml @@ -2,8 +2,10 @@ name: "Release" on: # yamllint disable-line rule:truthy push: - tags: - - "**" + branches: [master] + paths: + - "ccodashboard/dashboards/*" + - ".github/workflows/release.yml" jobs: release: @@ -11,7 +13,7 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Determine tag" - run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" + run: "echo \"RELEASE_TAG=${GITHUB_REPOSITORY}.v$GITHUB_RUN_NUMBER\" >> $GITHUB_ENV" - name: "Create release" uses: "actions/github-script@v5" with: