forked from DRVeyl/RealAntennas
-
Notifications
You must be signed in to change notification settings - Fork 5
87 lines (76 loc) · 3.09 KB
/
attach-release-artifacts.yml
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
87
name: "Attach Release Artifacts"
on:
release:
types: [published]
jobs:
attach-release-artifacts:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Get Branch
shell: bash
run: |
releaseBranch=${{ github.event.release.target_commitish }}
echo "Found branch ${releaseBranch}"
echo "tagged_branch=${releaseBranch}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.tagged_branch }}
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v5
with:
commit: ${{ github.sha }}
workflow: build.yml
name: RealAntennas
skip_unpack: true
- name: Update version file
uses: KSP-RO/BuildTools/update-version-file@master
with:
tag: ${{ github.event.release.tag_name }}
path: ${GITHUB_WORKSPACE}/GameData/RealAntennas/RealAntennas.version
- name: Update changelog file
uses: KSP-RO/BuildTools/process-changelog@master
with:
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
path: ${GITHUB_WORKSPACE}/GameData/RealAntennas/changelog.cfg
- name: Assemble release
id: assemble-release
run: |
RELEASE_DIR="${RUNNER_TEMP}/release"
echo "Release dir: ${RELEASE_DIR}"
echo "Release zip: ${RELEASE_DIR}/RealAntennas-${{ github.event.release.tag_name }}.zip"
mkdir -v "${RELEASE_DIR}"
echo "::set-output name=release-dir::${RELEASE_DIR}"
cp -v -R "${GITHUB_WORKSPACE}/GameData" "${RELEASE_DIR}"
cd ${RELEASE_DIR}
zip -r RealAntennas-${{ github.event.release.tag_name }}.zip GameData
ls -lrt -d -1 "${RELEASE_DIR}"/{*,.*}
- name: Upload package to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./RealAntennas.zip
asset_name: RealAntennas-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Commit changes
shell: bash
env:
TAG_STRING: ${{ github.event.release.tag_name }}
run: |
RELEASEBRANCH=${{ env.tagged_branch }}
git add "${GITHUB_WORKSPACE}/GameData/RealAntennas/RealAntennas.version"
git add "${GITHUB_WORKSPACE}/GameData/RealAntennas/changelog.cfg"
git commit -m "Update version to $TAG_STRING"
git push origin $RELEASEBRANCH
git tag $TAG_STRING $RELEASEBRANCH --force
git push origin $TAG_STRING --force