assets
assets copied to clipboard
runs-on container image
Setup a Docker image for the runner, with an imagemagick version supporting DWAB compression
https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container
https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub
https://chat.openai.com/share/62aa46ca-9f23-4eb6-8f31-e45ce9add14b
FROM node:18-alpine
RUN apk update && apk add --no-cache imagemagick make openssl git
WORKDIR /app
# USER node
name: release
on:
push:
branches:
- 'main'
# Cancel any previous run (see: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
changes-job:
runs-on: ubuntu-latest
outputs:
dockerfile: ${{ steps.changes.outputs.dockerfile }}
steps:
- uses: actions/checkout@v3
- id: changes
uses: dorny/paths-filter@v2
with:
filters: |
dockerfile:
- 'Dockerfile'
build-push-job:
needs: changes-job
if: needs.changes-job.outputs.dockerfile == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
- uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release-job:
needs: build-push-job
if: always() && needs.build-push-job.result == 'success' || needs.build-push-job.result == 'skipped'
runs-on: ubuntu-latest
container:
image: 'ghcr.io/${{ github.repository }}:main'
# options: --user root
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
- id: main
run: |
yarn install
yarn build
yarn release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}