Rebase Folder-Links #323
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: build | |
on: | |
push: | |
branches: [ master, staging ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
if: github.repository_owner == 'FNNDSC' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" # necessary for `npm run print-version` | |
- name: Get info | |
id: info | |
run: | | |
version="$(npm run -s print-version | tr '+' '-')" | |
echo "Version: $version" | |
echo "version_string=$version" >> "$GITHUB_OUTPUT" | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: network=host | |
- name: Login to DockerHub | |
id: dockerhub_login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get postfix of latest | |
id: postfix_of_latest | |
run: | | |
if [[ $GITHUB_REF_TYPE == tag || $GITHUB_REF_NAME == master ]]; then | |
echo "Postfix of latest: ''" | |
echo "postfix_of_latest=" >> $GITHUB_OUTPUT | |
else | |
echo "Postfix of latest: -$GITHUB_REF_NAME" | |
echo "postfix_of_latest=-$GITHUB_REF_NAME" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.7 | |
- run: npm ci | |
- run: npm run build | |
- name: Copy and push | |
uses: docker/build-push-action@v5 | |
with: | |
tags: | | |
docker.io/fnndsc/chris_ui:latest${{ steps.postfix_of_latest.outputs.postfix_of_latest}} | |
docker.io/fnndsc/chris_ui:${{ steps.info.outputs.version_string }}${{ steps.postfix_of_latest.outputs.postfix_of_latest}} | |
ghcr.io/fnndsc/chris_ui:latest${{ steps.postfix_of_latest.outputs.postfix_of_latest}} | |
ghcr.io/fnndsc/chris_ui:${{ steps.info.outputs.version_string }}${{ steps.postfix_of_latest.outputs.postfix_of_latest}} | |
context: . | |
file: ./Dockerfile_cp | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Update DockerHub description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
short-description: ChRIS user interface | |
readme-filepath: ./README.md | |
repository: fnndsc/chris_ui |