Release #4
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] | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get current date | |
id: get-date | |
run: | | |
echo "NOW=$(date +'%Y%m%dT%H%M%S')" >> $GITHUB_ENV | |
- name: npm install, build, and test | |
run: | | |
npm install | |
npm run build --if-present | |
npm test | |
- name: Get Version From package.json | |
id: get-version | |
uses: beaconbrigade/[email protected] | |
with: | |
path: . | |
- uses: ./.github/actions/nodeci-build-windows | |
with: | |
name: vlc-rpc-v${{steps.get-version.outputs.version}}-nightly${{env.NOW}}-bundled-win-x64 | |
- uses: ./.github/actions/nodeci-build-linux | |
with: | |
name: vlc-rpc-v${{steps.get-version.outputs.version}}-nightly${{env.NOW}}-bundled-linux-x64 | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: output/test/code-coverage.html | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vlc-rpc-v${{steps.get-version.outputs.version}}-bundled-win-x64 | |
path: | | |
.dist/win-x64 | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: code-coverage-report | |
path: output/test/code-coverage.html | |
- name: Check if release exists | |
id: check_release | |
run: | | |
set -e | |
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/v${{ steps.get-version.outputs.version }}") | |
if [[ $response -eq 200 ]]; then | |
echo "Release v${{ steps.get-version.outputs.version }}" exists. | |
echo "RELEASE_EXISTS=true" >> $GITHUB_ENV | |
else | |
echo "Release v${{ steps.get-version.outputs.version }}" does not exist. | |
echo "RELEASE_EXISTS=false" >> $GITHUB_ENV | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create or update GitHub Release | |
id: create_or_update_github_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: "V${{ steps.get-version.outputs.version }}" | |
release_name: "Pre-release ${{ steps.get-version.outputs.version }}" | |
draft: false | |
prerelease: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
if: env.RELEASE_EXISTS != 'true' | |
- name: Update nightly release | |
uses: pyTooling/Actions/releaser@main | |
with: | |
tag: ${{ steps.get-version.outputs.version }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: .dist/zipped/*.zip | |
if: env.RELEASE_EXISTS != 'true' |