Skip to content

Release

Release #33

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
env:
UI_BUILD_REACT: 'app/'
RELEASE_DIR: 'release'
UI_ARTIFACT_NAME: 'ui.tar.gz'
BUILD_INFO_FILE: 'buildInfo.json'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get Date
run: 'echo "BUILD_DATE=`date +%FT%T%z`" >> $GITHUB_ENV'
- uses: actions/checkout@v3
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '14.19.1'
- name: JS Build
env:
NODE_OPTIONS: '--max_old_space_size=2048'
run: |
npm --prefix ${{ env.UI_BUILD_REACT }} ci
npm --prefix ${{ env.UI_BUILD_REACT }} run lint
npm --prefix ${{ env.UI_BUILD_REACT }} run test:coverage
npm --prefix ${{ env.UI_BUILD_REACT }} run build
- name: Generate Build info
run: |
echo '{"build": { "version": "${{ github.event.inputs.version }}", "branch": "${{ github.ref_name }}-${{ github.sha }}", "build_date": "${{ env.BUILD_DATE }}", "name": "Service UI", "repo": "${{ github.repository }}"}}' > ./${{ env.UI_BUILD_REACT }}build/${{ env.BUILD_INFO_FILE }}
- name: Create release directory
run: mkdir -v ${{ github.workspace }}/${{ env.RELEASE_DIR }}
- name: UI assets compress
run: 'cd ${{ env.UI_BUILD_REACT }}build && tar -czvf "${{ github.workspace }}/${{ env.RELEASE_DIR }}/${{ env.UI_ARTIFACT_NAME }}" ./'
- name: Setup git credentials
uses: oleksiyrudenko/gha-git-credentials@v2
with:
name: 'reportportal.io'
email: 'support@reportportal.io'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Tag release
id: tagRelease
run: |
git tag -a v${{ github.event.inputs.version }} -m 'Release ${{ github.event.inputs.version }}'
git push --tags
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: false
- name: Upload UI Asset
id: upload-ui-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: '${{ github.workspace }}/${{ env.RELEASE_DIR }}/${{ env.UI_ARTIFACT_NAME }}'
asset_name: ${{ env.UI_ARTIFACT_NAME }}
asset_content_type: application/gzip
- name: Commit version
run: |
echo ${{ github.event.inputs.version }} > ${{ github.workspace }}/VERSION
git add ${{ github.workspace }}/VERSION
export CHANGED=`git status | grep VERSION | xargs`
[ -z "${CHANGED}" ] || git commit -m 'Commit version'
git push