forked from manjaro/release-review
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (120 loc) · 5.04 KB
/
release.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release
on:
release:
types: [edited]
workflow_dispatch:
inputs:
release-tag:
description: 'Release tag'
required: true
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
download_dir: ./download
public_url: https://files.manjaro.download
MATRIX_ROOM_ID: "!XXstZzLEcUVKyTcqCA:matrix.org"
jobs:
mirror:
runs-on: ubuntu-latest
name: Copy release to the mirror
environment:
name: stable-mirror
url: https://release.manjaro.download
strategy:
matrix:
edition:
- kde
- xfce
- gnome
- i3
- cinnamon
- sway
env:
release_tag: ${{ inputs.release-tag || github.event.release.tag_name }}
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: download & extract release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release view ${{ env.release_tag }} --json assets --jq '[[.assets[]][] | select(.name | contains("-${{ matrix.edition }}-")) | select(.name | contains("-unstable-") | not) | select(.name | contains("-testing-") | not)] | sort_by(.name)' >docs/assets.json
mkdir -p $download_dir
for url in $(cat docs/assets.json | jq -r '.[].url'); do
wget -q -P $download_dir $url
echo downloaded $url
done
# unzip files
for file in $download_dir/*.iso.zip; do
zip -FF $file --out manjaro-full.zip && unzip manjaro-full.zip -d $download_dir/
echo unzipped $file
done
## remove unzipped files
rm -f $download_dir/*.zip || echo ok
rm -f $download_dir/*.z01 || echo ok
du -h $download_dir
ls $download_dirlatest
- name: create edition release file-list
id: files
run: |
(cd $download_dir && ls -l *iso*) | \
jq --compact-output -s -R 'split("\n") | [.[] | select(length > 0) | split(" ") | [.[] | select(. == "" | not)] | { size: .[4] | tonumber, name: .[-1], url: "${{ env.public_url }}/${{ env.release_tag }}/\(.[-1])" }]' \
> /tmp/release.json
echo "list=$(cat /tmp/release.json)" >> $GITHUB_OUTPUT
- name: write matrix outputs
uses: cloudposse/github-action-matrix-outputs-write@v1
id: out
with:
matrix-step-name: ${{ github.job }}
matrix-key: ${{ matrix.edition }}
outputs: |-
files: ${{ steps.files.outputs.list }}
- name: s3 sync downloads
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_REGION: 'auto'
SOURCE_DIR: ${{ env.download_dir}}
DEST_DIR: ${{ env.release_tag }}
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
release:
runs-on: ubuntu-latest
needs: mirror
outputs:
result: "${{ steps.read.outputs.result }}"
permissions:
contents: write
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: receive matrix outputs
uses: cloudposse/github-action-matrix-outputs-read@v1
id: read
with:
matrix-step-name: mirror
- name: write release info
run: |
echo '${{ steps.read.outputs.result }}' | jq --sort-keys '.[]' > docs/_data/release.json
cp docs/_data/release.json docs/release.json
- name: commit
run: |
git config user.name repo-add-bot
git config user.email [email protected]
git add docs/_data/release.json docs/release.json
if [[ `git status --porcelain | grep release.json` ]]; then
git status --porcelain
git commit -m "update release.json"
git push
fi
- name: announce
uses: s3krit/[email protected]
with:
room_id: ${{ env.MATRIX_ROOM_ID}}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "🌱 Success publishing release [${{ inputs.release-tag || github.event.release.tag_name }}](https://manjaro.download) for **x86**!"
server: "matrix.org"