Merge branch 'main' into main #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to DockerHub | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
env: | |
DOCKER_USER: bilts | |
jobs: | |
push: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Log into registry | |
run: echo "${{ secrets.DOCKERHUB }}" | docker login -u "${DOCKER_USER}" --password-stdin | |
- name: Setup Node | |
run: | | |
npm install | |
- name: Build and publish images | |
run: | | |
# For tagged versions, translate e.g. "refs/tags/v1.2.3" -> "1.2.3" | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# For the main branch, use "latest" as the version | |
[ "${VERSION}" == "main" ] && VERSION=latest | |
[ "${VERSION}" == "harmony-412" ] && VERSION=latest | |
# build and publish images for all services | |
VERSION="${VERSION}" lerna run build | |
VERSION="${VERSION}" lerna run publish | |