Skip to content

Commit

Permalink
added update examples workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Mar 12, 2024
1 parent f7142c6 commit c368911
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 32 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/examples-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update examples version

on:
repository_dispatch:
types: [ update-examples ]

defaults:
run:
shell: pwsh

jobs:
update-examples-version:
if: ${{ github.event_name == 'repository_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
- run: |
$oldTag = "${{ github.event.client_payload.oldTag }}"
$newTag = "${{ github.event.client_payload.newTag }}"
. .\update-version.ps1 # Import the functions
dir -r .\docs\**\*.md | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
dir -r .github\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
dir -r .azure\**\*.yml | % { update-md-files $_ -OldVersion $oldTag -NewVersion $newTag }
git add --verbose .
git config user.name 'Artur'
git config user.email 'arturcic@gmail.com'
git commit -m "update examples version to $newTag" --allow-empty
git push --force
name: Update examples version
82 changes: 50 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,68 @@
name: release
on:
release:
types: [published]
types: [ published ]

defaults:
run:
shell: pwsh

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v4
- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
- run: |
npm install
npm run build:agent:github
npm run build:agent:azure
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PUSH_GITHUB_TOKEN }}
- run: |
npm install
npm run build:agent:github
npm run build:agent:azure
# npm run compress:github
# npm run compress:azure
name: Build code
- name: Install GitVersion
uses: ./gitversion/setup
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: ./gitversion/execute
- run: |
$date = Get-Date -format "yyMMddHH"
$version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date"
$major = "${{steps.gitversion.outputs.major}}"
$minor = "${{steps.gitversion.outputs.minor}}"
$patch = "${{steps.gitversion.outputs.patch}}"
# npm run compress:github
# npm run compress:azure
name: Build code
- name: Install GitVersion
uses: ./gitversion/setup
with:
versionSpec: '5.x'
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: ./gitversion/execute
- run: |
$date = Get-Date -format "yyMMddHH"
$version = "${{steps.gitversion.outputs.majorMinorPatch}}.$date"
$major = "${{steps.gitversion.outputs.major}}"
$minor = "${{steps.gitversion.outputs.minor}}"
$patch = "${{steps.gitversion.outputs.patch}}"
. .\update-version.ps1 # Import the functions
update-manifest .\dist\azure\vss-extension.json -Version $version
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor -Patch $patch }
. .\update-version.ps1 # Import the functions
update-manifest .\dist\azure\vss-extension.json -Version $version
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor -Patch $patch }
npm run publish:azure -- --token ${{ secrets.TFX_TOKEN }}
name: Publish Azure extension
- name: Get tags
id: get-tags
shell: pwsh
run: |
# Finding the version from release tag
npm run publish:azure -- --token ${{ secrets.TFX_TOKEN }}
$newTag = "${{steps.gitversion.outputs.majorMinorPatch}}"
$oldTag = $(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)).Trim("v")
echo "Old tag: $oldTag"
echo "New tag: $newTag"
name: Publish Azure extension
"oldTag=$oldTag" >> $env:GITHUB_OUTPUT
"newTag=$newTag" >> $env:GITHUB_OUTPUT
- uses: peter-evans/repository-dispatch@v3
name: Trigger Update Examples version
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
repository: ${{ github.repository }}
event-type: update-examples
client-payload: '{"oldTag": "${{ steps.get-tags.outputs.oldTag }}", "newTag": "${{ steps.get-tags.outputs.newTag }}"}'

0 comments on commit c368911

Please sign in to comment.