Skip to content

Commit

Permalink
Merge pull request #496 from alphagov/release-publish
Browse files Browse the repository at this point in the history
Add merge actions
  • Loading branch information
gidsg committed Jan 26, 2021
2 parents 986f7ba + fa77fc7 commit 7924db5
Show file tree
Hide file tree
Showing 9 changed files with 851 additions and 720 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/publish_package.yml
@@ -0,0 +1,22 @@
name: Node.js Package
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
50 changes: 50 additions & 0 deletions .github/workflows/publish_pages.yml
@@ -0,0 +1,50 @@
name: Publish Pages

on:
push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Read .python-version
run: echo ::set-output name=python-version::$(cat .python-version)
id: python-version

- uses: actions/setup-python@v2
with:
python-version: '${{ steps.python-version.outputs.python-version }}'

- uses: actions/cache@v2
id: node-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/cache@v2
with:
path: venv
key: venv-${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: venv-${{ runner.os }}-

- name: Install Node version
shell: bash -l {0}
run: nvm install

- name: Install Node dependencies
run: npm install
if: steps.node-cache.outputs.cache-hit != 'true'

- run: make generate_pages

- name: Push to gh-pages
uses: peaceiris/actions-gh-pages@8457ade3d7045b4842e5a10f733d4153b7d05238
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./pages
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,33 @@
name: Tag release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get package version
id: package_version
run: echo "::set-output name=package-version::v$(jq -r ".version" package.json)"

- name: Check if version tag already exists
id: version_tag
uses: mukunku/tag-exists-action@f8003af57c02ede2638326be67523df10cf6b10a
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.package_version.outputs.package-version }}

- name: Create GitHub release
if: ${{ steps.version_tag.outputs.exists == 'false' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.DM_GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package_version.outputs.package-version }}
release_name: Release v${{ steps.package_version.outputs.package-version }}
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Expand Up @@ -7,14 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 10.x

- name: Read .python-version
run: echo ::set-output name=python-version::$(cat .python-version)
id: python-version

- uses: actions/setup-python@v2
with:
python-version: '3.6.x'
python-version: '${{ steps.python-version.outputs.python-version }}'

- uses: actions/cache@v2
with:
Expand All @@ -29,6 +29,9 @@ jobs:
key: venv-${{ runner.os }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: venv-${{ runner.os }}-

- name: Install Node version
shell: bash -l {0}
run: nvm install

- run: npm install
- run: make test
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
10.23.0
1 change: 1 addition & 0 deletions .python-version
@@ -0,0 +1 @@
3.6.9
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -162,8 +162,8 @@ To make a new version:
changes you are making; for a larger PR you might want a separate commit with a message that summarises the entire PR.

When the pull request is merged
[a Jenkins job](https://ci.marketplace.team/view/Utils%20and%20toolkit/job/tag-toolkit/)
will be run to tag the new version.
[Github Actions](https://github.com/alphagov/digitalmarketplace-frontend-toolkit/tree/master/.github/workflows)
will be run to tag and publish the new version.

## Licence

Expand Down

0 comments on commit 7924db5

Please sign in to comment.