|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: {} |
5 | | - pull_request_review: |
6 | | - types: [submitted, edited] |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "*" |
| 7 | + pull_request_target: {} |
7 | 8 |
|
8 | 9 | jobs: |
9 | 10 | test: |
|
50 | 51 |
|
51 | 52 | - name: Build gem |
52 | 53 | run: gem build daemon_controller.gemspec |
53 | | - |
54 | | - - name: Upload gem artifact |
55 | | - uses: actions/upload-artifact@v4 |
56 | | - with: |
57 | | - name: gem |
58 | | - path: "daemon_controller-*.gem" |
59 | | - |
60 | | - release: |
61 | | - runs-on: ubuntu-24.04 |
62 | | - needs: |
63 | | - - test |
64 | | - - lint-and-build |
65 | | - if: startsWith(github.ref, 'refs/tags/') |
66 | | - environment: release |
67 | | - permissions: |
68 | | - contents: write |
69 | | - id-token: write |
70 | | - attestations: write |
71 | | - steps: |
72 | | - - name: Checkout code |
73 | | - uses: actions/checkout@v4 |
74 | | - |
75 | | - - name: Set up Ruby |
76 | | - uses: ruby/setup-ruby@v1 |
77 | | - with: |
78 | | - ruby-version: "3.4" |
79 | | - bundler-cache: true |
80 | | - |
81 | | - - name: Verify version number |
82 | | - id: get_version |
83 | | - run: | |
84 | | - VERSION_STRING=$(ruby -r ./lib/daemon_controller/version.rb -e "puts DaemonController::VERSION_STRING") |
85 | | - if ! [[ "$GITHUB_REF_NAME" =~ ^release- ]]; then |
86 | | - echo "Tag name must start with a 'release-'." |
87 | | - exit 1 |
88 | | - fi |
89 | | - if [[ "$GITHUB_REF_NAME" != "release-${VERSION_STRING}" ]]; then |
90 | | - echo "Tag version ($GITHUB_REF_NAME) does not match version.rb ($VERSION_STRING)" |
91 | | - exit 1 |
92 | | - fi |
93 | | -
|
94 | | - - name: Download gem artifact |
95 | | - uses: actions/download-artifact@v4 |
96 | | - with: |
97 | | - name: gem |
98 | | - |
99 | | - - name: Create attestation |
100 | | - uses: actions/attest-build-provenance@v2 |
101 | | - with: |
102 | | - subject-path: "daemon_controller-*.gem" |
103 | | - |
104 | | - - name: Push gem to RubyGems |
105 | | - run: gem push daemon_controller-*.gem |
106 | | - env: |
107 | | - GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} |
108 | | - |
109 | | - - name: Create GitHub release |
110 | | - run: gh release create "$GITHUB_REF_NAME" *.gem --title "$GITHUB_REF_NAME" --notes-from-tag |
111 | | - env: |
112 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments