Skip to content

Commit

Permalink
build(ci): add publish to Docker Hub (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle authored Aug 7, 2024
1 parent 28f06b3 commit 284916f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/npmpublish.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
publish-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
registry-url: https://registry.npmjs.org/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- run: echo TAGNAME=`echo ${{ github.ref_name }} | sed 's/v//'` >> ${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
opengovsg/mockpass:latest
opengovsg/mockpass:${{ env.TAGNAME }}

0 comments on commit 284916f

Please sign in to comment.