Skip to content

Commit

Permalink
added tagging workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
saidsef committed Sep 2, 2021
1 parent 036eecc commit 48e7a9d
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tagging
on:
push:
branches:
- master
workflow_run:
workflows:
- CodeQL
types:
- completed
workflow_dispatch:

jobs:
tagging:
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'master') }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Set Tag Value
run: |
echo "DATE=v$(echo `date +'%Y.%m'`)" >> $GITHUB_ENV
- name: Create Tag
uses: actions/github-script@v4
if: ${{ env.DATE }}
with:
github-token: ${{ github.token }}
script: |
let tagExists = [];
try {
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.DATE }}",
sha: context.sha
});
} catch (e) {
console.log("Tag already exists: " + e)
tagExists.push(e);
}
if (tagExists.length > 0) {
await github.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ env.DATE }}",
sha: context.sha
});
}

0 comments on commit 48e7a9d

Please sign in to comment.