Skip to content

Commit c368911

Browse files
committed
added update examples workflow
1 parent f7142c6 commit c368911

File tree

2 files changed

+83
-32
lines changed

2 files changed

+83
-32
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update examples version
2+
3+
on:
4+
repository_dispatch:
5+
types: [ update-examples ]
6+
7+
defaults:
8+
run:
9+
shell: pwsh
10+
11+
jobs:
12+
update-examples-version:
13+
if: ${{ github.event_name == 'repository_dispatch' }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
19+
- run: |
20+
$oldTag = "${{ github.event.client_payload.oldTag }}"
21+
$newTag = "${{ github.event.client_payload.newTag }}"
22+
23+
. .\update-version.ps1 # Import the functions
24+
dir -r .\docs\**\*.md | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
25+
dir -r .github\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
26+
dir -r .azure\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
27+
28+
git add --verbose .
29+
git config user.name 'Artur'
30+
git config user.email '[email protected]'
31+
git commit -m "update examples version to $newTag" --allow-empty
32+
git push --force
33+
name: Update examples version

.github/workflows/release.yml

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,68 @@
11
name: release
22
on:
33
release:
4-
types: [published]
4+
types: [ published ]
55

66
defaults:
77
run:
88
shell: pwsh
99

1010
jobs:
1111
build:
12-
1312
runs-on: ${{ matrix.os }}
1413
strategy:
1514
matrix:
16-
os: [ubuntu-latest]
15+
os: [ ubuntu-latest ]
1716
steps:
18-
- uses: actions/checkout@v4
19-
- name: Fetch all history for all tags and branches
20-
run: |
21-
git fetch --prune --unshallow
22-
- run: |
23-
npm install
24-
npm run build:agent:github
25-
npm run build:agent:azure
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
21+
- run: |
22+
npm install
23+
npm run build:agent:github
24+
npm run build:agent:azure
25+
26+
# npm run compress:github
27+
# npm run compress:azure
28+
name: Build code
29+
- name: Install GitVersion
30+
uses: ./gitversion/setup
31+
with:
32+
versionSpec: '5.x'
33+
- name: Use GitVersion
34+
id: gitversion # step id used as reference for output values
35+
uses: ./gitversion/execute
36+
- run: |
37+
$date = Get-Date -format "yyMMddHH"
38+
$version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date"
39+
$major = "${{steps.gitversion.outputs.major}}"
40+
$minor = "${{steps.gitversion.outputs.minor}}"
41+
$patch = "${{steps.gitversion.outputs.patch}}"
2642
27-
# npm run compress:github
28-
# npm run compress:azure
29-
name: Build code
30-
- name: Install GitVersion
31-
uses: ./gitversion/setup
32-
with:
33-
versionSpec: '5.x'
34-
- name: Use GitVersion
35-
id: gitversion # step id used as reference for output values
36-
uses: ./gitversion/execute
37-
- run: |
38-
$date = Get-Date -format "yyMMddHH"
39-
$version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date"
40-
$major = "${{steps.gitversion.outputs.major}}"
41-
$minor = "${{steps.gitversion.outputs.minor}}"
42-
$patch = "${{steps.gitversion.outputs.patch}}"
43+
. .\update-version.ps1 # Import the functions
44+
update-manifest .\dist\azure\vss-extension.json -Version $version
45+
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor -Patch $patch }
4346
44-
. .\update-version.ps1 # Import the functions
45-
update-manifest .\dist\azure\vss-extension.json -Version $version
46-
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor -Patch $patch }
47+
npm run publish:azure -- --token ${{ secrets.TFX_TOKEN }}
48+
name: Publish Azure extension
49+
- name: Get tags
50+
id: get-tags
51+
shell: pwsh
52+
run: |
53+
# Finding the version from release tag
4754
48-
npm run publish:azure -- --token ${{ secrets.TFX_TOKEN }}
55+
$newTag = "${{steps.gitversion.outputs.majorMinorPatch}}"
56+
$oldTag = $(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)).Trim("v")
57+
echo "Old tag: $oldTag"
58+
echo "New tag: $newTag"
4959
50-
name: Publish Azure extension
60+
"oldTag=$oldTag" >> $env:GITHUB_OUTPUT
61+
"newTag=$newTag" >> $env:GITHUB_OUTPUT
62+
- uses: peter-evans/repository-dispatch@v3
63+
name: Trigger Update Examples version
64+
with:
65+
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
66+
repository: ${{ github.repository }}
67+
event-type: update-examples
68+
client-payload: '{"oldTag": "${{ steps.get-tags.outputs.oldTag }}", "newTag": "${{ steps.get-tags.outputs.newTag }}"}'

0 commit comments

Comments
 (0)