-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (60 loc) · 2.36 KB
/
Copy pathcreateReleaseGHJob.yml
File metadata and controls
62 lines (60 loc) · 2.36 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
name: Create Release Github Job
on:
workflow_call:
inputs:
RELEASE_VERSION:
description: 'Release information, e.g. v{{version}}'
type: string
required: true
RELEASE_CHANGE_ARTEFACT:
description: 'Uploaded Artefact containing the Changelog diff between releases'
type: string
required: true
RELEASE_CHANGE_FILENAME:
description: 'Name of file referenced from Uploaded Artefact containing the Changelog diff between releases'
type: string
required: true
secrets:
GH_TOKEN:
description: 'Github API Token'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.RELEASE_VERSION }}
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.RELEASE_CHANGE_ARTEFACT }}
path: /tmp/
- name: Release info
run: |
echo "RELEASE_CHANGE_ARTEFACT/RELEASE_CHANGE_FILENAME contents:"
cat /tmp/${{ inputs.RELEASE_CHANGE_FILENAME }}
echo "------------------------------"
echo "RELEASE_TAG=${{ inputs.RELEASE_VERSION }}"
- name: Create Release @${{ inputs.RELEASE_VERSION }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ inputs.RELEASE_VERSION }}
release_name: Release ${{ inputs.RELEASE_VERSION }}
# body: "" # optional, body_path used instead.
body_path: /tmp//${{ inputs.RELEASE_CHANGE_FILENAME }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./CHANGELOG.md
asset_name: CHANGELOG.md
asset_content_type: text/markdown