|
| 1 | +name: Merge to release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + commit_message: |
| 10 | + description: Commit message |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v2 |
| 20 | + if: github.event_name == 'push' |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + if: github.event_name == 'workflow_dispatch' |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Checkout release branch |
| 27 | + uses: actions/checkout@v2 |
| 28 | + with: |
| 29 | + ref: 'v1.0.1' |
| 30 | + path: './release' |
| 31 | + |
| 32 | + - name: Check for relevant changes |
| 33 | + if: github.event_name == 'push' |
| 34 | + uses: dorny/paths-filter@v2 |
| 35 | + id: release |
| 36 | + with: |
| 37 | + list-files: shell |
| 38 | + filters: | |
| 39 | + updated: |
| 40 | + - added|modified: [ '*.csl', '*.xml' ] |
| 41 | + deleted: |
| 42 | + - deleted: [ '*.csl', '*.xml' ] |
| 43 | +
|
| 44 | + - name: Changed files |
| 45 | + if: github.event_name == 'push' |
| 46 | + run: | |
| 47 | + echo updated: ${{ steps.release.outputs.updated_files }} |
| 48 | + echo deleted: ${{ steps.release.outputs.deleted_files }} |
| 49 | +
|
| 50 | + - name: Set up Ruby |
| 51 | + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) |
| 52 | + uses: ruby/setup-ruby@v1 |
| 53 | + with: |
| 54 | + ruby-version: 2.7.1 |
| 55 | + - name: but use cache to speed that up |
| 56 | + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) |
| 57 | + uses: actions/cache@v2 |
| 58 | + with: |
| 59 | + path: vendor/bundle |
| 60 | + key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-gems- |
| 63 | + - name: Bundle install |
| 64 | + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')) |
| 65 | + run: | |
| 66 | + bundle config path vendor/bundle |
| 67 | + bundle update sheldon --jobs 4 --retry 3 |
| 68 | +
|
| 69 | + - name: Populate new branch |
| 70 | + run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --populate release |
| 71 | + if: github.event_name == 'workflow_dispatch' |
| 72 | + |
| 73 | + - name: update the timestamps and add the changes |
| 74 | + run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.release.outputs.updated_files }} |
| 75 | + if: github.event_name == 'push' && steps.release.outputs.updated == 'true' |
| 76 | + |
| 77 | + - name: delete deleted files |
| 78 | + run: cd release && git rm ${{ steps.release.outputs.deleted_files }} |
| 79 | + if: github.event_name == 'push' && steps.release.outputs.deleted == 'true' |
| 80 | + |
| 81 | + - uses: stefanzweifel/git-auto-commit-action@v4 |
| 82 | + with: |
| 83 | + repository: 'release' |
| 84 | + commit_message: Releasing ${{ steps.release.outputs.updated_files }} ${{ steps.release.outputs.deleted_files }} |
| 85 | + if: github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true') |
| 86 | + |
| 87 | + - uses: stefanzweifel/git-auto-commit-action@v4 |
| 88 | + with: |
| 89 | + repository: 'release' |
| 90 | + commit_message: ${{ github.event.inputs.commit_message }} |
| 91 | + if: github.event_name == 'workflow_dispatch' |
0 commit comments