forked from primer/view_components
-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (92 loc) · 2.87 KB
/
Copy pathrelease.yml
File metadata and controls
102 lines (92 loc) · 2.87 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
name: Release
on:
push:
release:
types: [published]
permissions:
id-token: write # Required for OIDC
contents: read
checks: write
statuses: write
jobs:
publish-main:
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- uses: actions/setup-node@v5
with:
node-version: 20
cache: "npm"
- name: Create .gem credentials
run: |
mkdir -p $HOME/.gem
cat << EOF > $HOME/.gem/credentials
---
:rubygems_api_key: ${RUBYGEMS_TOKEN}
EOF
chmod 0600 $HOME/.gem/credentials
env:
RUBYGEMS_TOKEN: ${{ secrets.RUBYGEMS_TOKEN_SHARED }}
- uses: actions/setup-node@v6
with:
node-version: 24
- name: NPM install
run: |
npm ci
- name: Publish Gem
run: bundle exec rake release
- name: Publish NPM
run: npm publish --access public
release-main:
name: Main
if: ${{ github.repository == 'opf/primer_view_components' && github.ref_name == 'main' && github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "npm"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
- name: Install dependencies
run: |
npm ci
bundle install
- name: Create release pull request or publish to npm
id: changesets
uses: changesets/action@v1.4.10
with:
title: Release Tracking
version: npm run changeset:version
publish: script/changeset-publish
env:
GITHUB_TOKEN: ${{ steps.get-access-token.outputs.token }}
release-canary:
name: Canary
if: ${{ github.repository == 'opf/primer_view_components' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' && github.event_name == 'push' }}
uses: primer/.github/.github/workflows/release_canary.yml@v2.4.0
with:
install: npm i
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
release-candidate:
name: Candidate
if: ${{ github.repository == 'opf/primer_view_components' && github.ref_name == 'changeset-release/main' && github.event_name == 'push' }}
uses: primer/.github/.github/workflows/release_candidate.yml@v2.4.0
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}