Skip to content

Commit

Permalink
Merge pull request #1468 from arturcic/feature/action-test
Browse files Browse the repository at this point in the history
Refactor workflows to add and utilize trigger-action-test.
  • Loading branch information
arturcic committed Jan 22, 2025
2 parents c60be73 + c5fff82 commit b4372b9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 20 deletions.
45 changes: 45 additions & 0 deletions .github/actions/trigger-action-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Trigger Action Test'
description: 'Test the actions/tasks in the action-test repository'
inputs:
mode:
description: 'Release mode'
required: true
majorMinorPatch:
description: 'Major.Minor.Patch version'
required: true
token:
description: 'Token for Azure DevOps'
required: true

outputs:
oldTag:
description: 'Old tag'
value: ${{ steps.get-tags.outputs.oldTag }}
newTag:
description: 'New tag'
value: ${{ steps.get-tags.outputs.newTag }}

runs:
using: 'composite'
steps:
- name: Get tags
id: get-tags
shell: pwsh
run: |
# Finding the version from release tag
$newTag = "${{ inputs.majorMinorPatch }}"
$oldTag = cat package.json | ConvertFrom-Json | Select-Object -ExpandProperty version
echo "Old tag: $oldTag"
echo "New tag: $newTag"
"oldTag=$oldTag" >> $env:GITHUB_OUTPUT
"newTag=$newTag" >> $env:GITHUB_OUTPUT
- uses: peter-evans/repository-dispatch@v3
name: Trigger Update Examples version (actions-test)
with:
token: ${{ inputs.token }}
repository: ${{ github.repository_owner }}/actions-test
event-type: update-examples-${{ inputs.mode }}
client-payload: '{"oldTag": "${{ steps.get-tags.outputs.oldTag }}", "newTag": "${{ steps.get-tags.outputs.newTag }}"}'
7 changes: 7 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ jobs:
minor: ${{ steps.gitversion.outputs.minor }}
patch: ${{ steps.gitversion.outputs.patch }}
token: ${{ secrets.TFX_TOKEN }}
- name: Trigger Update Examples version (actions-test)
id: get-tags
uses: ./.github/actions/trigger-action-test
with:
mode: 'test'
majorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
27 changes: 7 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,17 @@ jobs:
owner: ${{ github.repository_owner }}
repository: actions
milestone: "v${{ steps.gitversion.outputs.majorMinorPatch }}"
- name: Get tags
- name: Trigger Update Examples version (actions-test)
id: get-tags
shell: pwsh
run: |
# Finding the version from release tag
$newTag = "${{steps.gitversion.outputs.majorMinorPatch}}"
$oldTag = cat package.json | ConvertFrom-Json | Select-Object -ExpandProperty version
echo "Old tag: $oldTag"
echo "New tag: $newTag"
"oldTag=$oldTag" >> $env:GITHUB_OUTPUT
"newTag=$newTag" >> $env:GITHUB_OUTPUT
- uses: peter-evans/repository-dispatch@v3
name: Trigger Update Examples version (actions)
uses: ./.github/actions/trigger-action-test
with:
mode: 'prod'
majorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}
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 }}"}'
- uses: peter-evans/repository-dispatch@v3
name: Trigger Update Examples version (actions-test)
- name: Trigger Update Examples version (actions)
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
repository: ${{ github.repository_owner }}/actions-test
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 b4372b9

Please sign in to comment.