Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanH committed Jul 11, 2023
1 parent 3f44ba5 commit 08fe709
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 4 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/build-develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build electron releases - development

env:
NODE_VERSION: "14.18"

on:
push:
branches: [ "develop" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ ] # "develop"

jobs:
prep-release:
name: Create GitHub Release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create_release.outputs.id }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- id: package_json
run: |
content=`cat ./package.json`
# the following lines are only required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of optional handling for multi line json
echo "::set-output name=json::$content"
- name: Create tag string
id: create_tag_str
run: |
tag=$(basename "${{ github.ref }}")-$(date +%Y%m%d)
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Update package.json snapshot version
uses: jossef/[email protected]
with:
file: package.json
field: version
value: "${{ fromJson(steps.package_json.outputs.json).version }}-${{ steps.create_tag_str.outputs.tag }}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "v${{ fromJson(steps.package_json.outputs.json).version }}-${{ steps.create_tag_str.outputs.tag }}"
release_name: "v${{ fromJson(steps.package_json.outputs.json).version }}-${{ steps.create_tag_str.outputs.tag }}"
draft: true
prerelease: true

build-matrix:
needs: [ prep-release ]
strategy:
fail-fast: false
matrix:
node-version: [14.18]
os: [ ubuntu-latest, windows-latest, macos-latest ]

runs-on: ${{ matrix.os }}

# Platform-agnostic build
steps:
- uses: actions/checkout@v3
- uses: mskelton/[email protected]
with:
node-version: "${{ env.NODE_VERSION }}"
- run: make install
- run: make publish_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PUBLISH_FOR_PULL_REQUEST: true
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ env:

on:
push:
branches: [ "main", "develop" ]
# pull_request:
# branches: [ "main", "develop" ]
branches: [ "main" ]

jobs:
prep-release:
Expand Down Expand Up @@ -47,7 +45,7 @@ jobs:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
draft: true
prerelease: "${{ steps.create_tag.outputs.tag != fromJson(steps.package_json.outputs.json).version }}"
prerelease: false

build-matrix:
needs: [ prep-release ]
Expand Down

0 comments on commit 08fe709

Please sign in to comment.