forked from ABCPascal/SnapEnhanceModGen
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (32 loc) · 1.22 KB
/
test-latest-tag.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
name: Test Get Latest Tag
on:
workflow_dispatch:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for github-action-get-previous-tag
# Step 1: request upstream releases from github api using fjogeleit/http-request-action
- name: Obtain latest upstream release tag
# don't omit the step ID, it's used later to access the api response
id: upstream_releases
uses: fjogeleit/http-request-action@v1
with:
url: "https://api.github.com/repos/NicholasFlamy/snapenhance-no-root-patch/releases/latest"
method: 'GET'
# Step 2: since the branch name is different than the latest release tag the REGEX will select the correct branch
- name: REGEX the release tag
id: previoustag
uses: frabert/replace-string-action@v2
with:
pattern: '(v(\d+)\.(\d+)\.(\d+)\.(\d+))'
string: ${{ fromJson(steps.upstream_releases.outputs.response).tag_name }}
replace-with: '$1'
- name: Echo release name
run: |
echo ${{ steps.previoustag.outputs.replaced }}