chore(deps): lock file maintenance #1649
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Please | |
on: | |
push: | |
branches: | |
- '*.x' | |
- main | |
# Documentation: | |
# https://github.com/googleapis/release-please | |
# https://github.com/googleapis/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 | |
env: | |
IMAGE_REPO_STORYBOOK: ghcr.io/${{ github.repository }}/storybook | |
steps: | |
- uses: googleapis/release-please-action@v4 | |
id: release | |
with: | |
target-branch: ${{ github.ref_name }} | |
- name: Release Info | |
run: echo "$RELEASE_OUTPUT" | |
env: | |
RELEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }} | |
- name: 'Release: Determine version' | |
id: version | |
run: echo "version=$([[ "$VERSION" != "" ]] && echo "$VERSION" || echo "rev-$GITHUB_SHA")" >> $GITHUB_OUTPUT | |
env: | |
VERSION: ${{ steps.release.outputs.version }} | |
- name: Get token | |
id: get_token | |
uses: tibdex/github-app-token@v2 | |
with: | |
app_id: ${{ secrets.MAINTENANCE_APP_ID }} | |
private_key: ${{ secrets.MAINTENANCE_APP_PEM }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.get_token.outputs.token }} | |
- 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="${{ steps.version.outputs.version }}" yarn build | |
- name: Remove files with forbidden extensions | |
run: node ./scripts/clean-storybook-files.cjs | |
- name: 'Release: Determine npm tag' | |
if: ${{ steps.release.outputs.release_created }} | |
id: npm_tag | |
run: echo "npm_tag=$([[ "${{ steps.version.outputs.version }}" == *"-"* ]] && echo "next" || echo "latest")" >> $GITHUB_OUTPUT | |
- name: 'Release: Publish @sbb-esta/lyne-elements' | |
if: ${{ steps.release.outputs.release_created }} | |
run: yarn publish dist/elements --tag ${{ steps.npm_tag.outputs.npm_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 'Release: Publish @sbb-esta/lyne-elements-experimental' | |
if: ${{ steps.release.outputs.release_created }} | |
run: yarn publish dist/elements-experimental --tag ${{ steps.npm_tag.outputs.npm_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 'Release: Publish @sbb-esta/lyne-react' | |
if: ${{ steps.release.outputs.release_created }} | |
run: yarn publish dist/react --tag ${{ steps.npm_tag.outputs.npm_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 'Release: Publish @sbb-esta/lyne-react-experimental' | |
if: ${{ steps.release.outputs.release_created }} | |
run: yarn publish dist/react-experimental --tag ${{ steps.npm_tag.outputs.npm_tag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: 'Container: Login to GitHub Container Repository' | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: 'Container: Build and publish release image' | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
docker build --tag $IMAGE_REPO_STORYBOOK:$VERSION --tag $IMAGE_REPO_STORYBOOK:latest . | |
docker push $IMAGE_REPO_STORYBOOK:$VERSION | |
docker push $IMAGE_REPO_STORYBOOK:latest | |
env: | |
DOCKER_BUILDKIT: 1 | |
VERSION: ${{ steps.release.outputs.version }} | |
- name: Build slim image with version | |
if: ${{ steps.release.outputs.release_created }} | |
uses: kitabisa/docker-slim-action@v1 | |
with: | |
target: '${{ env.IMAGE_REPO_STORYBOOK }}:${{ steps.release.outputs.version }}' | |
tag: '${{ steps.release.outputs.version }}-slim' | |
env: | |
DSLIM_PRESERVE_PATH: /usr/share/nginx/html | |
- name: Build slim image with latest | |
if: ${{ steps.release.outputs.release_created }} | |
uses: kitabisa/docker-slim-action@v1 | |
with: | |
target: '${{ env.IMAGE_REPO_STORYBOOK }}:latest' | |
tag: latest-slim | |
env: | |
DSLIM_PRESERVE_PATH: /usr/share/nginx/html | |
- name: Push slim image | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
docker push $IMAGE_REPO_STORYBOOK:$VERSION-slim | |
docker push $IMAGE_REPO_STORYBOOK:latest-slim | |
docker image list | |
env: | |
VERSION: ${{ steps.release.outputs.version }} | |
- name: 'Container: Build and publish dev image' | |
run: | | |
docker build --tag $IMAGE_REPO_STORYBOOK:dev . | |
docker push $IMAGE_REPO_STORYBOOK:dev | |
env: | |
DOCKER_BUILDKIT: 1 | |
- name: Build slim image with dev | |
uses: kitabisa/docker-slim-action@v1 | |
with: | |
target: '${{ env.IMAGE_REPO_STORYBOOK }}:dev' | |
tag: dev-slim | |
env: | |
DSLIM_PRESERVE_PATH: /usr/share/nginx/html | |
- name: Push slim image | |
run: | | |
docker push $IMAGE_REPO_STORYBOOK:dev-slim | |
docker image list | |
- name: Cherry-pick CHANGELOG.md into ${{ github.event.repository.default_branch }} | |
if: ${{ steps.release.outputs.release_created && github.ref_name != 'main' }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "github-actions" | |
git checkout ${{ github.event.repository.default_branch }} | |
git show ${{ github.sha }} -- CHANGELOG.md | git apply - | |
git commit -a -m "chore: update changelog" | |
git push | |
- name: Update maintenance issue | |
if: ${{ steps.release.outputs.release_created && failure() }} | |
run: yarn ts-hooks scripts/update-maintenance-issue.ts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FAILED_RELEASE: ${{ steps.release.outputs.version }} |