Skip to content

Publish release

Publish release #5

name: Publish release
on:
release:
types: [created]
jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: extract-package-version
id: package-version
uses: Saionaro/[email protected]
- run: "echo 'Detected version: ${{steps.package-version.outputs.version}}'"
outputs:
version: ${{steps.package-version.outputs.version}}
check-release-version-match:
needs: get-version
runs-on: ubuntu-latest
if: "github.ref_name != format('v{0}', needs.get-version.outputs.version)"
steps:
- run: echo "Github release name (${{github.ref_name}}) and package version (v${{needs.get-version.outputs.version}}) don't match, failing."; exit 1;
lint-build-publish:
needs: get-version
if: "github.ref_name == format('v{0}', needs.get-version.outputs.version)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: yarn install --immutable --immutable-cache --check-cache
- run: npx prettier --check .
- run: tsc -p ./tsconfig.prod.json
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: ./scripts/npmjs-repo-cleanup.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Build and publish to Docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: murznn/sites-sync:${{github.ref_name}},murznn/sites-sync:latest