|
| 1 | +# Copyright 2023 René Ferdinand Rivera Morell |
| 2 | +# Use, modification, and distribution are subject to the |
| 3 | +# Boost Software License, Version 1.0. (See accompanying file LICENSE.txt) |
| 4 | + |
| 5 | +name: "Release: Archives" |
| 6 | + |
| 7 | +on: |
| 8 | + # Allow manual runs. |
| 9 | + workflow_dispatch: |
| 10 | + # Run on publishing of releases. |
| 11 | + release: { types: [published] } |
| 12 | + # And run on pushes, for main and release branches. |
| 13 | + push: |
| 14 | + branches: ["main", "release", "version/*"] |
| 15 | + paths-ignore: |
| 16 | + [ |
| 17 | + ".circleci/**", |
| 18 | + ".cirrus.yml", |
| 19 | + ".drone.star", |
| 20 | + ".semaphore/**", |
| 21 | + ".travis.yml", |
| 22 | + "appveyor.yml", |
| 23 | + "azure-pipelines.yml", |
| 24 | + ".ci/azp-*.yml", |
| 25 | + ] |
| 26 | + |
| 27 | +jobs: |
| 28 | + archive: |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + include: |
| 32 | + - { name: "Zip", format: "zip", command: "zip -r -9" } |
| 33 | + - { |
| 34 | + name: "7z", |
| 35 | + format: "7z", |
| 36 | + command: "7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on", |
| 37 | + } |
| 38 | + - { name: "BZip2", format: "tar.bz2", command: "tar -cv -j -f" } |
| 39 | + - { name: "Zstd", format: "tar.zstd", command: "tar -cv --zstd -f" } |
| 40 | + runs-on: ubuntu-latest |
| 41 | + name: ${{ matrix.name }} |
| 42 | + steps: |
| 43 | + - name: "Checkout" |
| 44 | + uses: actions/checkout@main |
| 45 | + with: { path: "lyra" } |
| 46 | + |
| 47 | + - name: "Snapshot" |
| 48 | + run: | |
| 49 | + cd "${{github.workspace}}/lyra" |
| 50 | + version=`basename ${{github.ref_name}}` |
| 51 | + git archive --format=tar --output="${{github.workspace}}/lyra-${version}.tar" "${{github.ref_name}}" |
| 52 | + cd "${{github.workspace}}" |
| 53 | + mkdir "lyra-${version}" |
| 54 | + cd "lyra-${version}" |
| 55 | + tar -xvf "${{github.workspace}}/lyra-${version}.tar" |
| 56 | + rm -rf "${{github.workspace}}/lyra-${version}.tar" |
| 57 | + cd "${{github.workspace}}" |
| 58 | + ls -laF |
| 59 | +
|
| 60 | + - name: "Archive" |
| 61 | + run: | |
| 62 | + cd "${{github.workspace}}" |
| 63 | + version=`basename ${{github.ref_name}}` |
| 64 | + archive="${{github.workspace}}/lyra-${version}.${{matrix.format}}" |
| 65 | + ${{matrix.command}} "${archive}" "lyra-${version}" |
| 66 | + sha256sum -b "${archive}" > "${archive}.sha256sum.txt" |
| 67 | +
|
| 68 | + - name: "Cleanup" |
| 69 | + run: | |
| 70 | + cd "${{github.workspace}}" |
| 71 | + version=`basename ${{github.ref_name}}` |
| 72 | + rm -rf "${{github.workspace}}/lyra-${version}" |
| 73 | +
|
| 74 | + - name: "Upload" |
| 75 | + uses: actions/upload-artifact@main |
| 76 | + with: |
| 77 | + name: Lyra-${{matrix.name}} |
| 78 | + path: "${{github.workspace}}/lyra-*" |
| 79 | + |
| 80 | + - name: "Publish" |
| 81 | + uses: softprops/action-gh-release@master |
| 82 | + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} |
| 83 | + with: |
| 84 | + files: "${{github.workspace}}/lyra-*" |
0 commit comments