-
Notifications
You must be signed in to change notification settings - Fork 5.6k
73 lines (70 loc) · 2.78 KB
/
TagIt.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
on:
push:
tags:
# Only match TagIt tags, which always start with this prefix
- 'v20*'
name: TagIt
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/create-release to create a release
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Archive project
id: archive_project
run: |
FILE_NAME=${GITHUB_REPOSITORY#*/}-${GITHUB_REF##*/}
git archive ${{ github.ref }} -o ${FILE_NAME}.zip
git archive ${{ github.ref }} -o ${FILE_NAME}.tar.gz
echo "file_name=${FILE_NAME}" >> $GITHUB_OUTPUT
- name: Compute digests
id: compute_digests
run: |
echo "tgz_256=$(openssl dgst -sha256 ${{ steps.archive_project.outputs.file_name }}.tar.gz)" >> $GITHUB_OUTPUT
echo "tgz_512=$(openssl dgst -sha512 ${{ steps.archive_project.outputs.file_name }}.tar.gz)" >> $GITHUB_OUTPUT
echo "zip_256=$(openssl dgst -sha256 ${{ steps.archive_project.outputs.file_name }}.zip)" >> $GITHUB_OUTPUT
echo "zip_512=$(openssl dgst -sha512 ${{ steps.archive_project.outputs.file_name }}.zip)" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
Automated release from TagIt
<details>
<summary>File Hashes</summary>
<ul>
<li>${{ steps.compute_digests.outputs.zip_256 }}</li>
<li>${{ steps.compute_digests.outputs.zip_512 }}</li>
<li>${{ steps.compute_digests.outputs.tgz_256 }}</li>
<li>${{ steps.compute_digests.outputs.tgz_512 }}</li>
</ul>
</details>
draft: false
prerelease: false
- name: Upload zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.archive_project.outputs.file_name }}.zip
asset_name: ${{ steps.archive_project.outputs.file_name }}.zip
asset_content_type: application/zip
- name: Upload tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.archive_project.outputs.file_name }}.tar.gz
asset_name: ${{ steps.archive_project.outputs.file_name }}.tar.gz
asset_content_type: application/gzip