Version 0.30.3-rc1 #19
Workflow file for this run
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: pise-publish | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' | |
jobs: | |
build-and-test: | |
uses: ./.github/workflows/pise-build-and-test.yml | |
with: | |
pub-prep: true | |
v-tag: ${{github.ref_name}} | |
publish: | |
needs: build-and-test | |
environment: publish | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
env: | |
DH_NAMESPACE: proofscape | |
steps: | |
# ----------------------------------------- | |
# Set version var from ref name | |
- name: Set version var from ref name | |
run: echo "${{github.ref_name}}" | sed 's/v/PISE_VERS=/' >> $GITHUB_ENV | |
# Determine secondary docker image tag: "edge" if version num contains | |
# a hyphen; "latest" if not. | |
- name: Determine secondary docker image tag | |
run: | | |
echo "${{env.PISE_VERS}}" | sed -e "s/.*-.*/SECOND_TAG=edge/" | sed -e "s/[0-9].*/SECOND_TAG=latest/" >> $GITHUB_ENV | |
# ----------------------------------------- | |
# Checkout pise | |
# Need contents of pise/client dir, for npm publish | |
- name: Checkout pise | |
uses: actions/checkout@v3 | |
with: | |
path: pise | |
# ----------------------------------------- | |
- name: Make directories | |
run: | | |
mkdir pise/client/dist | |
# ----------------------------------------- | |
# Download artifacts from the build-and-test job | |
- name: Download client/dist/ise | |
uses: actions/download-artifact@v3 | |
with: | |
name: client-dist-ise-${{env.PISE_VERS}} | |
path: pise/client/dist/ise | |
- name: Download pise docker context files | |
uses: actions/download-artifact@v3 | |
with: | |
name: pise-contexts-${{env.PISE_VERS}} | |
path: contexts | |
# ----------------------------------------- | |
# Basic checks for visual inspection | |
# client/dist/ise | |
- name: Check client/dist/ise contents | |
working-directory: pise/client | |
run: ls -l dist/ise | |
- name: Check contexts | |
run: ls -l contexts | |
# ----------------------------------------- | |
# PUBLISHING | |
# ----------------------------------------- | |
# Manually control whether we're actually doing the publishing steps or not | |
# (Set vars to yes or no) | |
- name: Switch publishing on or off | |
id: switch | |
run: | | |
echo "pub-npm=yes" >> $GITHUB_OUTPUT | |
echo "pub-dh=yes" >> $GITHUB_OUTPUT | |
# ----------------------------------------- | |
# npm | |
# Check that certain files will be included | |
- name: Check npm publish dry-run | |
working-directory: pise/client | |
env: | |
NPDR: ../../npdr.txt | |
run: | | |
npm publish --dry-run 2>&1 | cat > $NPDR | |
cat $NPDR | grep LICENSE | |
cat $NPDR | grep NOTICE | |
# Set up npm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
# npm publish | |
- if: ${{ steps.switch.outputs.pub-npm == 'yes' }} | |
name: Do npm publish | |
working-directory: pise/client | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish | |
# ------------------------------------- | |
# Docker Hub | |
- name: Extract Docker contexts | |
working-directory: contexts | |
run: | | |
mkdir pise-server-context | |
mkdir pise-frontend-context | |
mkdir pise-oca-context | |
tar -x -f pise-server-context.tar.gz -C pise-server-context | |
tar -x -f pise-frontend-context.tar.gz -C pise-frontend-context | |
tar -x -f pise-oca-context.tar.gz -C pise-oca-context | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- if: ${{ steps.switch.outputs.pub-dh == 'yes' }} | |
name: Publish pise-server to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
context: contexts/pise-server-context | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{env.DH_NAMESPACE}}/pise-server:${{env.PISE_VERS}} | |
${{env.DH_NAMESPACE}}/pise-server:${{env.SECOND_TAG}} | |
- if: ${{ steps.switch.outputs.pub-dh == 'yes' }} | |
name: Publish pise-frontend to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
context: contexts/pise-frontend-context | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{env.DH_NAMESPACE}}/pise-frontend:${{env.PISE_VERS}} | |
${{env.DH_NAMESPACE}}/pise-frontend:${{env.SECOND_TAG}} | |
- if: ${{ steps.switch.outputs.pub-dh == 'yes' }} | |
name: Publish pise OCA to Docker Hub | |
uses: docker/build-push-action@v4 | |
with: | |
context: contexts/pise-oca-context | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{env.DH_NAMESPACE}}/pise:${{env.PISE_VERS}} | |
${{env.DH_NAMESPACE}}/pise:${{env.SECOND_TAG}} |