Skip to content

Commit b94b723

Browse files
committed
Refactor GitHub Actions to use environment variables
1 parent 8124014 commit b94b723

4 files changed

Lines changed: 15 additions & 18 deletions

File tree

.github/workflows/modgc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ jobs:
102102
env:
103103
arch: ${{ matrix.arch }}
104104
run: >-
105-
$SETARCH ../src/configure -C --disable-install-doc --with-modular-gc=${{ env.MODULAR_GC_DIR }}
105+
$SETARCH ../src/configure -C --disable-install-doc --with-modular-gc="${MODULAR_GC_DIR}"
106106
${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
107107
108108
- uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2

.github/workflows/publish.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ jobs:
2424
ruby-version: 3.3.4
2525

2626
- name: Store Ruby version
27+
env:
28+
RUBY_VERSION: ${{ github.event.client_payload.version || github.event.inputs.version }}
2729
run: |
28-
echo "RUBY_VERSION=${{ github.event.client_payload.version || github.event.inputs.version }}" >> $GITHUB_ENV
30+
echo "RUBY_VERSION=${RUBY_VERSION}" >> $GITHUB_ENV
2931
3032
- name: Store ABI version
31-
run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV
33+
run: echo "ABI_VERSION=$(echo ${RUBY_VERSION} | cut -d '.' -f 1-2)" >> $GITHUB_ENV
3234

3335
- name: Copy draft package `/tmp` to `/pub` directory
34-
run: tool/release.sh ${{ env.RUBY_VERSION }}
36+
run: tool/release.sh ${RUBY_VERSION}
3537
env:
3638
AWS_ACCESS_KEY_ID: ${{ secrets.FTP_R_L_O_AWS_ACCESS_KEY_ID }}
3739
AWS_SECRET_ACCESS_KEY: ${{ secrets.FTP_R_L_O_AWS_SECRET_ACCESS_KEY }}
@@ -41,19 +43,19 @@ jobs:
4143
run: |
4244
curl -X POST \
4345
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
44-
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz
46+
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${ABI_VERSION}/ruby-${RUBY_VERSION}.tar.gz
4547
curl -X POST \
4648
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
47-
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.xz
49+
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${ABI_VERSION}/ruby-${RUBY_VERSION}.tar.xz
4850
curl -X POST \
4951
-H "Fastly-Key: ${{ secrets.FASTLY_PURGE_TOKEN }}" \
50-
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.zip
52+
https://api.fastly.com/purge/cache.ruby-lang.org/pub/ruby/${ABI_VERSION}/ruby-${RUBY_VERSION}.zip
5153
5254
- name: Create a release on GitHub
5355
run: |
54-
RELEASE_TAG=$(ruby tool/ruby-version.rb tag "${{ env.RUBY_VERSION }}")
56+
RELEASE_TAG=$(ruby tool/ruby-version.rb tag "${RUBY_VERSION}")
5557
echo $RELEASE_TAG
56-
PREVIOUS_RELEASE_TAG=$(ruby tool/ruby-version.rb previous-tag "${{ env.RUBY_VERSION }}")
58+
PREVIOUS_RELEASE_TAG=$(ruby tool/ruby-version.rb previous-tag "${RUBY_VERSION}")
5759
echo $PREVIOUS_RELEASE_TAG
5860
tool/gen-github-release.rb $PREVIOUS_RELEASE_TAG $RELEASE_TAG --no-dry-run
5961
env:
@@ -75,7 +77,7 @@ jobs:
7577
-H "Accept: application/vnd.github+json" \
7678
-H "X-GitHub-Api-Version: 2022-11-28" \
7779
https://api.github.com/repos/ruby/docker-images/actions/workflows/build.yml/dispatches \
78-
-d '{"ref": "master", "inputs": {"ruby_version": "${{ env.RUBY_VERSION }}"}}'
80+
-d "{\"ref\": \"master\", \"inputs\": {\"ruby_version\": \"${RUBY_VERSION}\"}}"
7981
8082
- name: Build snapcraft packages
8183
run: |
@@ -84,7 +86,7 @@ jobs:
8486
-H "Accept: application/vnd.github+json" \
8587
-H "X-GitHub-Api-Version: 2022-11-28" \
8688
https://api.github.com/repos/ruby/snap.ruby/dispatches \
87-
-d '{"event_type": "build", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}"}}'
89+
-d "{\"event_type\": \"build\", \"client_payload\": {\"ruby_version\": \"${RUBY_VERSION}\"}}"
8890
8991
- name: Store the latest LTS version of OpenSSL
9092
run: |
@@ -97,7 +99,7 @@ jobs:
9799
-H "Accept: application/vnd.github+json" \
98100
-H "X-GitHub-Api-Version: 2022-11-28" \
99101
https://api.github.com/repos/rbenv/ruby-build/dispatches \
100-
-d '{"event_type": "update-ruby", "client_payload": {"ruby_version": "${{ env.RUBY_VERSION }}", "openssl_version": "${{ env.OPENSSL_VERSION }}"}}'
102+
-d "{\"event_type\": \"update-ruby\", \"client_payload\": {\"ruby_version\": \"${RUBY_VERSION}\", \"openssl_version\": \"${OPENSSL_VERSION}\"}}"
101103
102104
- name: Update all-ruby definition
103105
run: |

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
-H "Accept: application/vnd.github+json" \
1616
-H "X-GitHub-Api-Version: 2022-11-28" \
1717
https://api.github.com/repos/ruby/actions/dispatches \
18-
-d '{"event_type": "${{ github.ref }}"}'
18+
-d "{\"event_type\": \"$GITHUB_REF\"}"

.github/zizmor.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ rules:
2020
ignore:
2121
- mingw.yml
2222
- windows.yml
23-
template-injection:
24-
ignore:
25-
- modgc.yml
26-
- publish.yml
27-
- release.yml
2823
unpinned-images:
2924
ignore:
3025
- compilers.yml

0 commit comments

Comments
 (0)