-
Notifications
You must be signed in to change notification settings - Fork 257
72 lines (62 loc) · 2.35 KB
/
release.yml
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
name: Release
on:
push:
branches:
- main
- next
- version-*
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: github.repository == 'apollographql/federation'
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install Dependencies
run: npm i
- name: Set env
run: echo "FEDERATION_VERSION=$(npm --prefix ./internals-js version --json |jq -r '.["@apollo/federation-internals"]')" >> $GITHUB_ENV
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
with:
title: "release: on branch ${{ github.ref_name }}"
createGithubReleases: true
publish: npm run build-and-publish
# workaround for https://github.com/changesets/action/issues/203, includes an `npm i` after running the version command
version: npm run changeset-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Sleep for 20 seconds (arbitrary, give NPM time to populate new `latest` versions)
if: steps.changesets.outputs.published == 'true'
run: sleep 20
shell: bash
- name: Kick off release in federation-rs
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.ACTION_PAT }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'apollographql',
repo: 'federation-rs',
workflow_id: '.github/workflows/release.yml',
ref: 'main',
inputs: {
version: "${{ env.FEDERATION_VERSION }}"
}
})
# - name: Write token to the NPM rc file (login)
# if: steps.changesets.outputs.published == 'true'
# # write token to the NPM rc file (npm login)
# run: echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > ~/.npmrc
# - name: Update next tags if appropriate
# if: steps.changesets.outputs.published == 'true'
# run: node scripts/update-next-tags.mjs