Skip to content

Commit c67bdc7

Browse files
committed
CI: build packages
1 parent 0b409f1 commit c67bdc7

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Ruby
22

33
on:
44
push:
5-
branches:
6-
- master
7-
85
pull_request:
6+
schedule:
7+
- cron: '35 6 * * *'
8+
workflow_dispatch:
99

1010
jobs:
1111
ruby-versions:
@@ -19,12 +19,20 @@ jobs:
1919
needs: ruby-versions
2020
name: CI (${{ matrix.ruby }} / ${{ matrix.os }})
2121
runs-on: ${{ matrix.os }}
22+
outputs:
23+
chksum_ubuntu: ${{ steps.build.outputs.chksum_ubuntu }}
24+
chksum_windows: ${{ steps.build.outputs.chksum_windows }}
2225
strategy:
2326
matrix:
2427
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
25-
os: [ ubuntu-latest, windows-latest ]
28+
os: [ ubuntu-24.04, windows-latest ]
2629

2730
steps:
31+
- name: git config
32+
run: |
33+
git config --global core.autocrlf false
34+
git config --global core.eol lf
35+
git config --global advice.detachedHead 0
2836
- uses: actions/checkout@v4
2937
- name: Set up Ruby
3038
uses: ruby/setup-ruby@v1
@@ -33,3 +41,39 @@ jobs:
3341
bundler-cache: true
3442
- name: Run the default task
3543
run: bundle exec rake
44+
45+
- id: build
46+
run: |
47+
bundle exec rake build
48+
sum="`sha256sum -b pkg/*`"
49+
echo "$sum"
50+
echo "chksum_${BUILD_PLATFORM%%-*}=$sum" >> $GITHUB_OUTPUT
51+
echo "pkg=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT
52+
if: >-
53+
${{
54+
github.event_name == 'push' &&
55+
(matrix.ruby == needs.ruby-versions.outputs.latest)
56+
}}
57+
env:
58+
BUILD_PLATFORM: ${{ matrix.os }}
59+
shell: bash
60+
- name: Upload package
61+
uses: actions/upload-artifact@v4
62+
with:
63+
path: pkg/*.gem
64+
name: ${{steps.build.outputs.pkg}}-${{matrix.os}}
65+
if: >-
66+
steps.build.outputs.pkg &&
67+
startsWith(matrix.os, 'ubuntu')
68+
69+
comp:
70+
name: ${{ github.workflow }} result
71+
runs-on: ubuntu-latest
72+
needs: [build]
73+
steps:
74+
- run: test "$chksum_ubuntu" = "$chksum_windows"
75+
working-directory:
76+
shell: bash
77+
env:
78+
chksum_ubuntu: ${{ needs.build.outputs.chksum_ubuntu }}
79+
chksum_windows: ${{ needs.build.outputs.chksum_windows }}

0 commit comments

Comments
 (0)