Debian Codegraph @

essentials/.github/workflows/integrate.yml

raw
1 # main only
2
3 name: Integrate
4
5 on:
6 push:
7 branches: [main]
8
9 env:
10 FORCE_COLOR: 1
11
12 jobs:
13 tagIfNewVersion:
14 name: Tag if new version
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout repository
18 uses: actions/checkout@v2
19 with:
20 # Ensure to have complete history of commits pushed with given push operation
21 # It's loose and imperfect assumption that no more than 30 commits will be pushed at once
22 fetch-depth: 30
23 # Tag needs to be pushed with real user token, otherwise pushed tag won't trigger the actions workflow
24 # Hence we're passing 'serverless-ci' user authentication token
25 token: ${{ secrets.USER_GITHUB_TOKEN }}
26 - name: Tag if new version
27 if: github.event.before != '0000000000000000000000000000000000000000' # Skip on first commit
28 run: |
29 NEW_VERSION=`git diff -U0 ${{ github.event.before }} package.json | grep '"version": "' | tail -n 1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` || :
30 if [ -n "$NEW_VERSION" ];
31 then
32 git tag v$NEW_VERSION
33 git push --tags
34 fi