Release #39
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: | |
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 | |
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])" }]' \ | |
> $download_dir/release.json | |
echo "list=$(cat $download_dir/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 '.[]' > 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` ]]; then | |
git status --porcelain | |
git commit -m "update release.json" | |
git push | |
fi |