|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + schedule: |
| 6 | + # At 4:17am each day |
| 7 | + # If this is changed, also change the 'yesterday' variable below. |
| 8 | + - cron: '17 4 1 * *' |
| 9 | + |
| 10 | +jobs: |
| 11 | + release: |
| 12 | + name: Release |
| 13 | + runs-on: ubuntu-18.04 |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: Configure |
| 19 | + id: config |
| 20 | + run: | |
| 21 | + last="$(date --date='4:17am yesterday' '+%s')" |
| 22 | + commitdate="$(git log -1 --format='%cd' --date=unix)" |
| 23 | + authordate="$(git log -1 --format='%ad' --date=unix)" |
| 24 | + release_date="" |
| 25 | + if [ "$commitdate" -gt "$last" ] || [ "$authordate" -gt "$last" ]; then |
| 26 | + release_date="$(date '+%F')" |
| 27 | + fi |
| 28 | + printf "release_date=%s\n" "$release_date" |
| 29 | + printf "::set-output name=release-date::%s\n" "$release_date" |
| 30 | +
|
| 31 | + - name: Build collection |
| 32 | + run: make archives |
| 33 | + |
| 34 | + - name: Create release |
| 35 | + if: ${{ steps.config.outputs.release-date != '' }} |
| 36 | + id: create_release |
| 37 | + uses: actions/create-release@v1 |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + RELEASE_DATE: ${{ steps.config.outputs.release-date }} |
| 41 | + with: |
| 42 | + tag_name: v${{ env.RELEASE_DATE }} |
| 43 | + release_name: Lua Filters v${{ env.RELEASE_DATE }} |
| 44 | + draft: false |
| 45 | + prerelease: false |
| 46 | + |
| 47 | + - name: Add zip archive to release |
| 48 | + uses: actions/upload-release-asset@v1 |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + with: |
| 52 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 53 | + asset_path: ./.build/lua-filters.zip |
| 54 | + asset_name: lua-filters.zip |
| 55 | + asset_content_type: application/zip |
| 56 | + |
| 57 | + - name: Add tar archive to release |
| 58 | + uses: actions/upload-release-asset@v1 |
| 59 | + env: |
| 60 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + with: |
| 62 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 63 | + asset_path: ./.build/lua-filters.tar.gz |
| 64 | + asset_name: lua-filters.tar.gz |
| 65 | + asset_content_type: application/x-gtar |
0 commit comments