Skip to content

Commit

Permalink
Merge pull request #10 from ruby/pkg
Browse files Browse the repository at this point in the history
CI: build packages
  • Loading branch information
nobu authored Oct 17, 2024
2 parents 521f93a + b44ef97 commit def4c84
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
46 changes: 45 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ jobs:
needs: ruby-versions
name: CI (${{ matrix.ruby }} / ${{ matrix.os }})
runs-on: ${{ matrix.os }}
outputs:
chksum_ubuntu: ${{ steps.build.outputs.chksum_ubuntu }}
chksum_windows: ${{ steps.build.outputs.chksum_windows }}
strategy:
matrix:
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ ubuntu-latest, windows-latest ]
os: [ ubuntu-24.04, windows-latest ]

steps:
- name: git config
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global advice.detachedHead 0
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -33,3 +41,39 @@ jobs:
bundler-cache: true
- name: Run the default task
run: bundle exec rake

- id: build
run: |
bundle exec rake build
sum="`sha256sum -b pkg/*`"
echo "$sum"
echo "chksum_${BUILD_PLATFORM%%-*}=$sum" >> $GITHUB_OUTPUT
echo "pkg=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT
if: >-
${{
github.event_name == 'push' &&
(matrix.ruby == needs.ruby-versions.outputs.latest)
}}
env:
BUILD_PLATFORM: ${{ matrix.os }}
shell: bash
- name: Upload package
uses: actions/upload-artifact@v4
with:
path: pkg/*.gem
name: ${{steps.build.outputs.pkg}}-${{matrix.os}}
if: >-
steps.build.outputs.pkg &&
startsWith(matrix.os, 'ubuntu')
comp:
name: ${{ github.workflow }} result
runs-on: ubuntu-latest
needs: [build]
steps:
- run: test "$chksum_ubuntu" = "$chksum_windows"
working-directory:
shell: bash
env:
chksum_ubuntu: ${{ needs.build.outputs.chksum_ubuntu }}
chksum_windows: ${{ needs.build.outputs.chksum_windows }}
5 changes: 5 additions & 0 deletions rakelib/epoch.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
task "build" => "date_epoch"

task "date_epoch" do
ENV["SOURCE_DATE_EPOCH"] = IO.popen(%W[git -C #{__dir__} log -1 --format=%ct], &:read).chomp
end

0 comments on commit def4c84

Please sign in to comment.