Release #27
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
decription: 'A semantic version to use when tagging this release.' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [ 18.x ] | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
# Build and publish @danielbingham/peerreview-model | |
- name: Install Model Dependencies | |
working-directory: ./packages/model | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm ci | |
- name: Run Model Unit Tests | |
working-directory: ./packages/model | |
run: | | |
npm run test | |
- name: Version the Model Package | |
working-directory: ./packages/model | |
run: | | |
npm version ${{ github.event.inputs.version }} | |
- name: Publish to Github Packages | |
working-directory: ./packages/model | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm publish | |
# Build and publish @danielbingham/peerreview-backend | |
- name: Install Backend NPM Modules | |
working-directory: ./packages/backend | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm ci | |
- name: Install updated model version | |
working-directory: ./worker | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install @danielbingham/peerreview-model@${{ github.event.inputs.version }} | |
- name: Run Backend Unit Tests | |
working-directory: ./packages/backend | |
run: | | |
npm run test | |
- name: Version the Backend Package | |
working-directory: ./packages/backend | |
run: | | |
npm version ${{ github.event.inputs.version }} | |
- name: Publish to Github Packages | |
working-directory: ./packages/backend | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm publish | |
# Build the worker docker container and push it to the Github Container | |
# registry | |
- name: Install Worker NPM Modules | |
working-directory: ./worker | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm ci | |
- name: Install updated backend version | |
working-directory: ./worker | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install @danielbingham/peerreview-backend@${{ github.event.inputs.version }} | |
- name: Install updated model version | |
working-directory: ./worker | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install @danielbingham/peerreview-model@${{ github.event.inputs.version }} | |
- name: Version the worker package | |
working-directory: ./worker | |
run: | | |
npm version ${{ github.event.inputs.version }} | |
- name: Build the Worker Docker Container | |
working-directory: ./worker | |
run: | | |
docker build --build-arg TOKEN=${{ secrets.GITHUB_TOKEN }} -t ghcr.io/danielbingham/peerreview-worker:${{ github.event.inputs.version }} . | |
- name: Login to Github Container Repository | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_REPOSITORY_OWNER --password-stdin | |
- name: Push the newly built container to the Repostory under the ${{ github.event.inputs.version }} tag | |
run: | | |
docker push ghcr.io/danielbingham/peerreview-worker:${{ github.event.inputs.version }} | |
# Test web-application, then build the docker container and push it to | |
# the Github Container registry | |
- name: Install Web Application NPM Modules | |
working-directory: ./web-application | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm ci | |
- name: Install updated backend version | |
working-directory: ./web-application | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install @danielbingham/peerreview-backend@${{ github.event.inputs.version }} | |
- name: Install updated model version | |
working-directory: ./worker | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm install @danielbingham/peerreview-model@${{ github.event.inputs.version }} | |
- name: Run Web Application Unit Tests | |
working-directory: ./web-application | |
run: | | |
npm run test | |
- name: Version the web application | |
working-directory: ./web-application | |
run: | | |
npm version ${{ github.event.inputs.version }} | |
- name: Build the Web Application Docker Container | |
working-directory: ./web-application | |
run: | | |
docker build --build-arg TOKEN=${{ secrets.GITHUB_TOKEN }} -t ghcr.io/danielbingham/peerreview:${{ github.event.inputs.version }} . | |
- name: Login to Github Container Repository | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $GITHUB_REPOSITORY_OWNER --password-stdin | |
- name: Push the newly built container to the Repostory under the ${{ github.event.inputs.version }} tag | |
run: | | |
docker push ghcr.io/danielbingham/peerreview:${{ github.event.inputs.version }} | |
# Commit the changes to the package.json package-lock.json files that | |
# were made during versioning. | |
- name: Commit the version changes | |
run: | | |
NAME=$( git log --format="%an" ${{ github.sha }}^! ) | |
EMAIL=$( git log --format="%ae" ${{ github.sha }}^! ) | |
git config --global user.name $NAME | |
git config --global user.email $EMAIL | |
git commit -am 'Version ${{ github.event.inputs.version }}' | |
git push origin | |
- name: Tag the version | |
run: | | |
NAME=$( git log --format="%an" ${{ github.sha }}^! ) | |
EMAIL=$( git log --format="%ae" ${{ github.sha }}^! ) | |
git config --global user.name $NAME | |
git config --global user.email $EMAIL | |
git tag ${{ github.event.inputs.version }} | |
git push origin --tags | |