-
-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (76 loc) · 3.2 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (76 loc) · 3.2 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Create Release and Publish
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
release_tag:
description: "Tag to release (for manual reruns)"
required: true
type: string
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.release_tag || github.ref_name }}
- name: Resolve release ref
id: release_ref
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
release_tag="${{ inputs.release_tag }}"
else
release_tag="${{ github.ref_name }}"
fi
release_sha="$(git rev-list -n 1 "$release_tag")"
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
echo "release_sha=$release_sha" >> "$GITHUB_OUTPUT"
- name: Download artifact from tagged commit CI run
uses: dawidd6/action-download-artifact@v21
with:
workflow: ci.yml
workflow_conclusion: success
commit: ${{ steps.release_ref.outputs.release_sha }}
name: Release
path: ./Release/
if_no_artifact_found: fail
- uses: AtlassianPS/AtlassianPS.Standards/.github/actions/setup-powershell@9a9367e22847bd24f86208ed2d98d207b0e2a3b3 # v0.1.6
- name: Publish module
run: Invoke-Build -Task Publish -VersionToPublish ${{ steps.release_ref.outputs.release_tag }}
-PSGalleryAPIKey ${{ secrets.PSGALLERY_API_KEY }}
shell: pwsh
- name: Cherry pick CHANGELOG.md
id: changelog
uses: MatteoCampinoti94/changelog-to-release@v1.0.6
with:
version-name: ${{ steps.release_ref.outputs.release_tag }}
configuration: ./.github/changelog.configuration.json
if: ${{ hashFiles('CHANGELOG.md') != '' }}
- name: Create Release and Upload Asset
uses: softprops/action-gh-release@v3
with:
body: ${{ steps.changelog.outputs.body }}
tag_name: ${{ steps.release_ref.outputs.release_tag }}
name: ${{ steps.release_ref.outputs.release_tag }}
files: ./Release/AtlassianPS.Configuration.zip
fail_on_unmatched_files: true
draft: false
prerelease: ${{ contains(steps.release_ref.outputs.release_tag, 'alpha') || contains(steps.release_ref.outputs.release_tag, 'beta') || contains(steps.release_ref.outputs.release_tag, 'rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify homepage to update submodule
if: ${{ !contains(steps.release_ref.outputs.release_tag, 'alpha') && !contains(steps.release_ref.outputs.release_tag, 'beta') && !contains(steps.release_ref.outputs.release_tag, 'rc') }}
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.HOMEPAGE_PAT }}
repository: AtlassianPS/AtlassianPS.github.io
event-type: module-release
client-payload: "{\"module\": \"AtlassianPS.Configuration\", \"version\": \"${{ steps.release_ref.outputs.release_tag }}\"}"