-
Notifications
You must be signed in to change notification settings - Fork 5
123 lines (108 loc) · 4.21 KB
/
Copy pathbuild.yml
File metadata and controls
123 lines (108 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: build
on:
repository_dispatch:
types: [build]
workflow_dispatch:
inputs:
ruby_version:
description: 'Ruby versions to build'
required: true
default: '3.3.4'
env:
# ABI series that also owns the default (trackless) latest channel.
LATEST_STABLE_TRACK: '4.0'
jobs:
build:
name: build with snapcraft (${{ matrix.platform }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- platform: amd64
os: ubuntu-24.04
- platform: arm64
os: ubuntu-24.04-arm
# - platform: armhf
# os: ubuntu-24.04-arm
steps:
- name: Check out Git repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Store Ruby version
env:
RAW_RUBY_VERSION: ${{ github.event.client_payload.ruby_version || github.event.inputs.ruby_version }}
run: |
if [[ ! "$RAW_RUBY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9]+)?$ ]]; then
echo "Invalid ruby version: $RAW_RUBY_VERSION" >&2
exit 1
fi
echo "RUBY_VERSION=$RAW_RUBY_VERSION" >> $GITHUB_ENV
- name: Generate template file
run: ruby generate.rb "$RUBY_VERSION"
- uses: snapcore/action-build@3bdaa03e1ba6bf59a65f84a751d943d549a54e79 # v1.3.0
id: snapcraft
with:
snapcraft-args: pack
- name: Determine release channel
run: |
ABI_VERSION=$(echo "$RUBY_VERSION" | cut -d '.' -f 1-2)
echo "ABI_VERSION=$ABI_VERSION" >> $GITHUB_ENV
if [[ "$RUBY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
RELEASE="$ABI_VERSION/stable,$ABI_VERSION/edge"
if [[ "$ABI_VERSION" == "$LATEST_STABLE_TRACK" ]]; then
RELEASE="$RELEASE,stable"
fi
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
else
# preview/rc builds are not published; latest/edge tracks master.
echo "RELEASE=" >> $GITHUB_ENV
fi
- uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 # v1.2.0
if: env.RELEASE != ''
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: ${{ env.RELEASE }}
build-armhf:
name: build armhf with snapcraft
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Store Ruby version
env:
RAW_RUBY_VERSION: ${{ github.event.client_payload.ruby_version || github.event.inputs.ruby_version }}
run: |
if [[ ! "$RAW_RUBY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9]+)?$ ]]; then
echo "Invalid ruby version: $RAW_RUBY_VERSION" >&2
exit 1
fi
echo "RUBY_VERSION=$RAW_RUBY_VERSION" >> $GITHUB_ENV
- name: Generate template file
run: ruby generate.rb "$RUBY_VERSION"
- uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- uses: diddlesnaps/snapcraft-multiarch-action@cfd7a246fad6bea65bb92f69a1c8d07898c231e5 # v1.9.0
id: snapcraft
with:
architecture: armhf
- name: Determine release channel
run: |
ABI_VERSION=$(echo "$RUBY_VERSION" | cut -d '.' -f 1-2)
echo "ABI_VERSION=$ABI_VERSION" >> $GITHUB_ENV
if [[ "$RUBY_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
RELEASE="$ABI_VERSION/stable,$ABI_VERSION/edge"
if [[ "$ABI_VERSION" == "$LATEST_STABLE_TRACK" ]]; then
RELEASE="$RELEASE,stable"
fi
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
else
# preview/rc builds are not published; latest/edge tracks master.
echo "RELEASE=" >> $GITHUB_ENV
fi
- uses: snapcore/action-publish@214b86e5ca036ead1668c79afb81e550e6c54d40 # v1.2.0
if: env.RELEASE != ''
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: ${{ env.RELEASE }}