2022-05-30 09:47:15 +00:00
|
|
|
name: Publish
|
2022-05-18 16:06:58 +00:00
|
|
|
|
2022-05-19 16:14:47 +00:00
|
|
|
on:
|
2022-08-03 04:26:56 +00:00
|
|
|
workflow_dispatch:
|
2022-05-19 16:14:47 +00:00
|
|
|
push:
|
2022-05-30 09:47:15 +00:00
|
|
|
tags:
|
2022-10-06 09:44:52 +00:00
|
|
|
- '*v*'
|
2022-05-18 16:06:58 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-10-06 09:44:52 +00:00
|
|
|
npm-publish:
|
|
|
|
name: Publish npm packages
|
2022-05-19 16:14:47 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
steps:
|
2022-10-06 10:44:45 +00:00
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v3.0.2
|
2022-05-19 16:14:47 +00:00
|
|
|
- name: Install dependencies
|
2022-10-06 09:44:52 +00:00
|
|
|
run: npm ci --ignore-scripts
|
2022-10-05 12:17:03 +00:00
|
|
|
- name: Build packages
|
2022-05-19 16:14:47 +00:00
|
|
|
run: npm run build
|
2022-10-06 09:44:52 +00:00
|
|
|
- name: Set npm registry
|
|
|
|
run: npm config set registry 'https://wombat-dressing-room.appspot.com/'
|
|
|
|
- name: Publish Puppeteer
|
2022-10-06 10:25:20 +00:00
|
|
|
if: ${{ startsWith(github.ref_name, 'v') }}
|
2022-10-06 09:44:52 +00:00
|
|
|
env:
|
|
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_PUPPETEER}}
|
|
|
|
run: |
|
|
|
|
npm config set '//wombat-dressing-room.appspot.com/:_authToken' $NODE_AUTH_TOKEN
|
|
|
|
npm publish --workspace packages/puppeteer
|
2022-10-05 12:17:03 +00:00
|
|
|
- name: Publish packages
|
2022-10-06 10:25:20 +00:00
|
|
|
if: ${{ !startsWith(github.ref_name, 'v') }}
|
2022-05-19 16:14:47 +00:00
|
|
|
env:
|
2022-10-05 12:17:03 +00:00
|
|
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_RELEASE}}
|
2022-05-19 16:14:47 +00:00
|
|
|
run: |
|
2022-10-05 12:17:03 +00:00
|
|
|
npm config set '//wombat-dressing-room.appspot.com/:_authToken' $NODE_AUTH_TOKEN
|
2022-10-06 09:44:52 +00:00
|
|
|
npm publish --workspace packages/${GITHUB_REF_NAME%-v*}
|
|
|
|
docker-publish:
|
|
|
|
name: Publish Docker image
|
|
|
|
runs-on: ubuntu-latest
|
2022-10-06 10:25:20 +00:00
|
|
|
if: ${{ startsWith(github.ref_name, 'v') }}
|
2022-10-06 09:44:52 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
|
|
steps:
|
2022-10-06 10:44:45 +00:00
|
|
|
- name: Check out repository
|
|
|
|
uses: actions/checkout@v3.0.2
|
2022-10-06 09:44:52 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Build packages
|
|
|
|
run: npm run build
|
|
|
|
- name: Pack packages for docker
|
|
|
|
run: docker/pack.sh
|
|
|
|
# Based on https://docs.github.com/en/actions/publishing-packages/publishing-docker-images.
|
|
|
|
- name: Log in to the Container registry
|
2022-10-25 13:33:28 +00:00
|
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
2022-10-06 09:44:52 +00:00
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
2022-10-25 13:32:22 +00:00
|
|
|
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea
|
2022-10-06 09:44:52 +00:00
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
tags: |
|
|
|
|
latest
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Build and push the Docker image
|
|
|
|
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94
|
|
|
|
with:
|
|
|
|
context: ./docker
|
|
|
|
push: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|