2020-11-22 02:28:14 +00:00
|
|
|
name: publish
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- created
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
# Setup .npmrc file to publish to npm
|
|
|
|
- uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
# Align the version of Node here with ci.yml.
|
2021-11-10 23:41:38 +00:00
|
|
|
node-version: '17.x'
|
2020-11-22 02:28:14 +00:00
|
|
|
registry-url: 'https://registry.npmjs.org'
|
2021-02-27 03:15:56 +00:00
|
|
|
# Will also (through `prepare` hook): 1. install ./app, and 2. build
|
2021-09-20 15:15:57 +00:00
|
|
|
- run: npm ci --no-fund
|
2020-11-22 02:28:14 +00:00
|
|
|
- run: npm test
|
2021-02-27 03:15:56 +00:00
|
|
|
- run: npm run lint
|
2020-11-22 02:28:14 +00:00
|
|
|
- run: npm publish
|
|
|
|
env:
|
2022-01-06 15:14:31 +00:00
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
|
|
|
|
# Docker build image and push to DockerHub
|
|
|
|
docker:
|
|
|
|
needs: build
|
|
|
|
|
|
|
|
env:
|
|
|
|
IMAGE_ID: ${{ secrets.DOCKERHUB_USERNAME }}/nativefier
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Build image
|
|
|
|
run: docker build . --file Dockerfile --tag "$IMAGE_ID:latest"
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Tag and Push
|
|
|
|
run: |
|
|
|
|
# Tag docker image the commit SHA
|
|
|
|
docker tag "$IMAGE_ID:latest" "$IMAGE_ID:${GITHUB_SHA::8}"
|
|
|
|
|
|
|
|
# Push the images to the registry
|
|
|
|
docker push "$IMAGE_ID:latest"
|
|
|
|
docker push "$IMAGE_ID:${GITHUB_SHA::8}"
|