-
Notifications
You must be signed in to change notification settings - Fork 13
142 lines (131 loc) · 5.03 KB
/
release-please.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
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
137
138
139
140
141
142
name: Release Please
on:
push:
branches:
- main
# Documentation:
# https://github.com/googleapis/release-please
# https://github.com/google-github-actions/release-please-action
# https://github.com/googleapis/release-please/blob/main/docs/customizing.md
permissions:
contents: write
packages: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: true
- name: Release Info
run: echo "${{ steps.release.outputs }}"
release:
needs: release-please
if: needs.release-please.outputs.releases_created
runs-on: ubuntu-latest
env:
IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/lyne-components/storybook
VERSION: ${{ needs.release-please.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
scope: sbb-esta
- run: yarn install --frozen-lockfile --non-interactive
- name: Run build
run: STORYBOOK_COMPONENTS_VERSION=$VERSION yarn build
- name: 'Release: Determine npm tag'
id: npm_tag
run: echo "npm_tag=$([[ "$VERSION" == *"-"* ]] && echo "next" || echo "latest")" >> $GITHUB_OUTPUT
- name: 'Release: Publish @sbb-esta/lyne-components'
run: yarn publish dist/components --tag ${{ steps.npm_tag.outputs.npm_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Release: Publish @sbb-esta/lyne-components-react'
run: yarn publish dist/react --tag ${{ steps.npm_tag.outputs.npm_tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Remove files with forbidden extensions
run: node ./scripts/clean-storybook-files.cjs
- name: 'Container: Login to GitHub Container Repository'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: 'Container: Build image'
run: docker build -t $IMAGE_REPO:$VERSION -t $IMAGE_REPO:latest .
env:
DOCKER_BUILDKIT: 1
- name: 'Container: Publish image'
run: docker push $IMAGE_REPO:$VERSION
- name: 'Container: Publish image as latest'
run: docker push $IMAGE_REPO:latest
- name: Generate chromatic stories
run: yarn generate:chromatic-stories
- name: Create versioned storybook for chromatic
run: STORYBOOK_COMPONENTS_VERSION=$VERSION yarn build:storybook
env:
CHROMATIC: true
# Send storybook to chromatic. These snapshots should be accepted as new
# baseline in storybook.
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
storybookBuildDir: dist/storybook
autoAcceptChanges: true
exitZeroOnChanges: true
zip: true
non-release:
needs: release-please
if: needs.release-please.outputs.releases_created != true
runs-on: ubuntu-latest
env:
IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/lyne-components/storybook
VERSION: ${{ needs.release-please.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn install --frozen-lockfile --non-interactive
- name: Run build
run: STORYBOOK_COMPONENTS_VERSION="rev-$GITHUB_SHA" yarn build
- name: Remove files with forbidden extensions
run: node ./scripts/clean-storybook-files.cjs
- name: 'Container: Login to GitHub Container Repository'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: 'Container: Build image'
run: docker build -t $IMAGE_REPO:dev .
env:
DOCKER_BUILDKIT: 1
- name: 'Container: Publish image'
run: docker push $IMAGE_REPO:dev
- name: Generate chromatic stories
run: yarn generate:chromatic-stories
- name: Create versioned storybook for chromatic
run: STORYBOOK_COMPONENTS_VERSION="rev-$GITHUB_SHA" yarn build:storybook
env:
CHROMATIC: true
# Send storybook to chromatic. These snapshots should be accepted as new
# baseline in storybook.
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_TOKEN }}
storybookBuildDir: dist/storybook
autoAcceptChanges: true
exitZeroOnChanges: true
zip: true