This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
Merge pull request #343 from danskernesdigitalebibliotek/dependabot/n… #671
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: Deployment | |
on: | |
push: | |
branches-ignore: | |
# Dependabot does not have permissions to create releases | |
- 'dependabot/**' | |
jobs: | |
deploy_release: | |
name: "Deploy release" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- run: yarn install --frozen-lockfile | |
- name: Building | |
run: yarn css:build | |
- name: Bundling assets | |
run: ./bundle.sh | |
- name: Release with tag | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist.zip | |
- name: Release branch | |
if: startsWith(github.ref, 'refs/heads/') | |
uses: "marvinpinto/action-automatic-releases@v1.2.1" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
# Add prefix branch name to avoid duplicate git references. | |
automatic_release_tag: "release-${{ github.ref_name }}" | |
prerelease: true | |
title: ${{ github.ref_name }} | |
files: dist.zip | |
deploy_npm: | |
name: "Deploy NPM package" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: "https://npm.pkg.github.com" | |
scope: "@${{ github.repository_owner }}" | |
- run: yarn install --frozen-lockfile | |
- name: Building | |
run: yarn css:build | |
- name: Bundling assets | |
run: ./bundle.sh | |
- name: Modify package.json for local context | |
# Values in package.json must match the current GitHub repository to | |
# publish to it. | |
run: | | |
npm exec -- json -I -f package.json -e "this.name='@$GITHUB_REPOSITORY'" | |
npm exec -- json -I -f package.json -e "this.repository='https://github.com/$GITHUB_REPOSITORY'" | |
- name: Release branch | |
if: startsWith(github.ref, 'refs/heads/') | |
# Version 0.0.0-SHA is a schema that supports semantic versioning but | |
# should sink below proper versions. | |
# Output package.json to provide insight and help debugging | |
# Using branch names as tags allows other projects to track unreleased | |
# development. | |
run: | | |
NPM_TAG_NAME=$(echo $GITHUB_REF_NAME | tr -d [:space:] | tr -C [:alnum:] -) | |
npm version 0.0.0-$GITHUB_SHA --no-git-tag-version | |
echo $NPM_TAG_NAME | |
cat package.json | |
npm publish --tag $NPM_TAG_NAME | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release with tag | |
if: startsWith(github.ref, 'refs/tags/') | |
# The latest tag follows tagged versions to follow NPM conventions. | |
run: | | |
npm version $GITHUB_REF_NAME --no-git-tag-version | |
cat package.json | |
npm publish --tag latest | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |