Skip to content

Commit

Permalink
build: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDinh committed Mar 25, 2024
1 parent 523fd99 commit fc0e3e8
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 27 deletions.
30 changes: 15 additions & 15 deletions .github/actions/create-release/action.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: 'Create release'
description: 'Create a new release'
inputs:
github_token:
github-token:
description: 'The GitHub token'
required: true
production_release:
production-release:
description: 'Is production release?'
required: true
node_version:
node-version:
description: 'The Node version'
required: true
default: 20
outputs:
release_published:
release-published:
description: 'If the release was published'
release_version:
release-version:
description: 'The new release version'
release_id:
release-id:
description: 'The new release ID'

runs:
Expand All @@ -25,7 +25,7 @@ runs:
- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}
node-version: ${{ inputs.node-version }}

- name: install npm dependencies
run: npm install
Expand All @@ -35,20 +35,20 @@ runs:
id: get-next-version
run: npx semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ inputs.github-token }}
shell: bash

- name: create release - beta
if: ${{ inputs.production_release != 'true' }}
if: ${{ inputs.production-release != 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ inputs.github-token }}
run: 'npx semantic-release'
shell: bash

- name: create release
if: ${{ inputs.production_release == 'true' }}
if: ${{ inputs.production-release == 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
GITHUB_TOKEN: ${{ inputs.github-token }}
run: 'npx semantic-release --branches main'
shell: bash

Expand All @@ -68,7 +68,7 @@ runs:
- name: set outputs
id: set-outputs
run: |
echo "{release_published}=${{ steps.get-next-version.outputs.new-release-published }}" >> $GITHUB_OUTPUT
echo "{release_version}=${{ steps.get-next-version.outputs.new-release-version }}" >> $GITHUB_OUTPUT
echo "{release_id}=${{ steps.get-release-id.outputs.result }}" >> $GITHUB_OUTPUT
echo "{release-published}=${{ steps.get-next-version.outputs.new-release-published }}" >> $GITHUB_OUTPUT
echo "{release-version}=${{ steps.get-next-version.outputs.new-release-version }}" >> $GITHUB_OUTPUT
echo "{release-id}=${{ steps.get-release-id.outputs.result }}" >> $GITHUB_OUTPUT
shell: bash
23 changes: 12 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- '.idea/**'
workflow_dispatch:
inputs:
production_release:
production-release:
description: 'Production release?'
required: true
default: 'true'
Expand Down Expand Up @@ -40,6 +40,7 @@ jobs:
name: Build Website
uses: makerxstudio/shared-config/.github/workflows/node-build-zip.yml@main
with:
node-version: 20.x
build-path: dist
artifact-name: website
static-site: true
Expand All @@ -57,17 +58,17 @@ jobs:
with:
fetch-depth: 0

- name: create release
- name: Create release
id: create-release-action
uses: ./.github/actions/create-release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
production_release: ${{ github.ref_name == 'main' && inputs.production_release == 'true' }}
node_version: 20
github-token: ${{ secrets.GITHUB_TOKEN }}
production-release: ${{ github.ref_name == 'main' && inputs.production-release == 'true' }}
node-version: 20
outputs:
release_published: ${{ steps.create-release-action.outputs.new-release-release_published }}
release_version: ${{ steps.create-release-action.outputs.new-release-release_version }}
release_id: ${{ steps.create-release-action.outputs.release_id }}
release-published: ${{ steps.create-release-action.outputs.release-published }}
release-version: ${{ steps.create-release-action.outputs.release-version }}
release-id: ${{ steps.create-release-action.outputs.release-id }}

package-tauri:
needs:
Expand All @@ -77,7 +78,7 @@ jobs:
matrix:
platform: [macos-latest]
name: Package Tauri app
if: ${{ needs.create-release.outputs.release_published == 'true' }}
if: ${{ needs.create-release.outputs.release-published == 'true' }}

steps:
- uses: actions/checkout@v4
Expand All @@ -100,7 +101,7 @@ jobs:
- name: bump version in package.json
run: |
sed -i '' "s/\"version\": \"0.0.0\"/\"version\": \"${{ needs.create-release.outputs.release_version }}\"/g" "src-tauri/tauri.conf.json"
sed -i '' "s/\"version\": \"0.0.0\"/\"version\": \"${{ needs.create-release.outputs.release-version }}\"/g" "src-tauri/tauri.conf.json"
- name: install app dependencies
run: npm install
Expand All @@ -109,4 +110,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
releaseId: ${{ needs.create-release.outputs.release-id }}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@
}
}
],
"@semantic-release/github",
[
"@semantic-release/github",
{
"successComment": false,
"failTitle": false
}
],
"semantic-release-export-data"
]
}
Expand Down

0 comments on commit fc0e3e8

Please sign in to comment.