Merge pull request #1580 from ral-facilities/fix-datapublications-test #438
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 Build | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
tags: '*' | |
jobs: | |
build: | |
name: Release Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
# Ubuntu 16+ does not install libgconf-2-4 by default, so we need to install it ourselves (for Cypress) | |
run: | | |
npm config set scripts-prepend-node-path true | |
sudo apt-get install libgconf-2-4 | |
yarn --immutable | |
- name: Determine tag name | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ] | |
then | |
echo TAG_NAME=snapshot >> $GITHUB_ENV | |
elif [ "${{ github.ref }}" = "refs/heads/develop" ] | |
then | |
echo TAG_NAME=snapshot-develop >> $GITHUB_ENV | |
else | |
echo TAG_NAME=`basename ${{ github.ref }}` >> $GITHUB_ENV | |
fi | |
- name: Build datagateway-dataview | |
run: | | |
cd packages/datagateway-dataview | |
echo "REACT_APP_DATAVIEW_BUILD_DIRECTORY=/plugins/datagateway-dataview/" > .env.production | |
yarn build | |
mv build datagateway-dataview-$TAG_NAME | |
tar -czf ../../datagateway-dataview-$TAG_NAME.tar.gz datagateway-dataview-$TAG_NAME | |
- name: Build datagateway-download | |
run: | | |
cd packages/datagateway-download | |
echo "REACT_APP_DOWNLOAD_BUILD_DIRECTORY=/plugins/datagateway-download/" > .env.production | |
yarn build | |
mv build datagateway-download-$TAG_NAME | |
tar -czf ../../datagateway-download-$TAG_NAME.tar.gz datagateway-download-$TAG_NAME | |
- name: Build datagateway-search | |
run: | | |
cd packages/datagateway-search | |
echo "REACT_APP_SEARCH_BUILD_DIRECTORY=/plugins/datagateway-search/" > .env.production | |
yarn build | |
mv build datagateway-search-$TAG_NAME | |
tar -czf ../../datagateway-search-$TAG_NAME.tar.gz datagateway-search-$TAG_NAME | |
- name: Update snapshot tag | |
uses: richardsimko/update-tag@782c008c16efcff2a27f83238dc4b05ffd8f4b52 # v1 | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
- name: Create/update release | |
uses: johnwbyrd/update-release@1d5ec4791e40507e5eca3b4dbf90f0b27e7e4979 # v1.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: ./datagateway-dataview-${{ env.TAG_NAME }}.tar.gz ./datagateway-download-${{ env.TAG_NAME }}.tar.gz ./datagateway-search-${{ env.TAG_NAME }}.tar.gz | |
release: Release ${{ env.TAG_NAME }} | |
tag: ${{ env.TAG_NAME }} | |
prerelease: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' }} | |
draft: false |