new_release #175
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: mirror | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: | |
- new_release | |
concurrency: | |
group: "mirror" | |
cancel-in-progress: true | |
env: | |
download_dir: download/manjaro-sway | |
jobs: | |
pages: | |
environment: | |
name: mirror | |
url: https://mirror.manjaro-sway.download/manjaro-sway/release.json | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: download release assets | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
LATEST_RELEASE=$(gh release list --limit 1 --exclude-drafts | sed -e 's/\s.*$//') | |
gh release view ${LATEST_RELEASE} --json assets --jq '[.assets[]]' >docs/assets.json | |
mkdir -p $download_dir | |
cat docs/assets.json | jq '.[].url' | xargs wget -q -P $download_dir | |
# unzip files | |
for file in $download_dir/*.iso.zip; do | |
zip -FF $file --out manjaro-full.zip && unzip manjaro-full.zip -d $download_dir/ | |
done | |
## remove unzipped files | |
rm -f $download_dir/*.zip || echo ok | |
rm -f $download_dir/*.z01 || echo ok | |
ls $download_dir | |
- name: create release filelist | |
id: files | |
run: | | |
(cd $download_dir && ls -l *iso* *img*) | \ | |
jq --compact-output -s -R 'split("\n") | [.[] | select(length > 0) | split(" ") | [.[] | select(. == "" | not)] | { size: .[4] | tonumber, name: .[-1], url: "https://manjaro-sway.download/download?file=\(.[-1])" }]' \ | |
> $download_dir/release.json | |
- name: s3 sync downloads | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: 'manjaro-sway' | |
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'auto' | |
SOURCE_DIR: './download/manjaro-sway' | |
DEST_DIR: 'manjaro-sway' | |
AWS_S3_ENDPOINT: https://cd1e88db5a44de0f45317275cbcef879.r2.cloudflarestorage.com | |
- name: trigger cf pages build | |
run: curl -s -X POST ${{ secrets.CF_PAGES_WEBHOOK }} |