-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (118 loc) · 4.28 KB
/
release-please.yml
File metadata and controls
136 lines (118 loc) · 4.28 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
124
125
126
127
128
129
130
131
132
133
134
135
136
# Release Please opens/updates a Release PR from conventional commits on main.
# When that PR is merged, Release Please creates the GitHub Release + v* tag, then
# publish-hex runs the same Postgres-backed test bar as CI and publishes with HEX_API_KEY.
#
# Requires repository secret: HEX_API_KEY (Actions secrets).
# RELEASE_PLEASE_TOKEN: optional fine-grained PAT. Using it for Release Please
# makes release-branch pushes and PRs run required CI (GITHUB_TOKEN does not
# chain-trigger other workflows). Also use if branch rules block the default token.
name: Release Please
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
concurrency:
group: release-please-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Run Release Please
id: release
uses: googleapis/release-please-action@v4
with:
# Optional: set secret RELEASE_PLEASE_TOKEN (fine-grained PAT) if the
# default token cannot open Release PRs; otherwise github.token suffices.
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
publish-hex:
name: Publish to Hex.pm
needs: release-please
if: ${{ needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sigra_test
ports:
- '5432:5432'
options: >-
--health-cmd pg_isready --health-interval 10s
--health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ needs.release-please.outputs.tag_name }}
- uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
with:
version-file: .tool-versions
version-type: strict
- name: Cache library deps
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
deps
_build
key: ${{ runner.os }}-library-${{ hashFiles('mix.lock') }}
- name: Install Hex + Rebar
run: |
mix local.hex --force
mix local.rebar --force
# Matches library_tests in ci.yml: InstallFixture shells out to mix phx.new.
- name: Install phx_new archive
run: mix archive.install --force hex phx_new
- name: Fetch library deps
run: mix deps.get
- name: Compile (warnings as errors)
run: mix compile --warnings-as-errors
- name: Verify release version in mix.exs
run: grep -n "@version \"${{ needs.release-please.outputs.version }}\"" mix.exs
- name: Run library tests
env:
MIX_ENV: test
PGUSER: postgres
PGPASSWORD: postgres
PGHOST: localhost
run: mix test
- name: Dry run Hex publish
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --dry-run --yes
- name: Publish to Hex
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes
- name: Verify version on Hex.pm
env:
VERSION: ${{ needs.release-please.outputs.version }}
run: |
set -euo pipefail
for i in $(seq 1 36); do
if curl -fsS "https://hex.pm/api/packages/sigra/releases/${VERSION}" | grep -q "\"version\""; then
echo "Hex.pm lists sigra ${VERSION}"
exit 0
fi
echo "waiting for Hex index... (${i}/36)"
sleep 10
done
echo "Timed out waiting for https://hex.pm/api/packages/sigra/releases/${VERSION}"
exit 1