-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the simple straight forward workflow
- Loading branch information
1 parent
a5b66a6
commit f95e292
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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]" |