-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 2.04 KB
/
release_in_one_job.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Release in one job
on:
workflow_dispatch:
jobs:
Release:
name: Release
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
env:
FILE: app/build.gradle
VERSION_REGEX: version\s*=\s*'[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: cache NPM
uses: actions/[email protected]
id: npm-cache
with:
path: |
**/node_modules
${{ needs.install.outputs.npm-cache-dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: "lts/*"
- name: Install dependencies
run: npm ci
- name: Calculate semantic version
id: calculate_semantic_version
run: |
export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/')
echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT
echo "new_tag_version=${NEXT_TAG_VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Update version and date in file
if: ${{ steps.calculate_semantic_version.new_tag_version != '' }}
run: |
VERSION=${{ steps.calculate_semantic_version.new_tag_version }}
sed -i "s/${{ env.VERSION_REGEX }}/version = '$VERSION'/g" ${{ env.FILE }}
- name: Apply release
if: ${{ steps.calculate_semantic_version.new_tag_version != '' }}
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_COMMITTER_NAME: "Arc-E-Tect"
GIT_COMMITTER_EMAIL: "[email protected]"
GIT_AUTHOR_NAME: "Arc-E-Tect"
GIT_AUTHOR_EMAIL: "[email protected]"