Skip to content

Commit

Permalink
Updated workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
syntax-tm committed May 10, 2024
1 parent 05f06be commit 57c353f
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,33 @@ name: Build
env:
ARTIFACT: SAM
PACKAGES: ${{ github.workspace }}\.nuget\packages
VERSION_PREFIX: 0.0.1
VERSION_SUFFIX: alpha

on:
workflow_call:
inputs:
is_release:
description: 'True if this build is for a release, false otherwise'
default: false
type: boolean
version-prefix:
description: 'The version prefix (e.g. "1.0.0")'
default: '0.0.1'
required: false
type: string
version-suffix:
description: 'The version suffix (e.g. "alpha")'
default: ''
required: false
type: string
workflow_dispatch:
push:
branches: [ "main", "master" ]
tags-ignore:
- v*
paths-ignore:
- 'resources/*'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
Expand Down Expand Up @@ -45,7 +63,7 @@ jobs:
path: ${{ env.PACKAGES }}
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
- name: Publish
run: dotnet publish .\src\SAM\SAM.csproj -c Debug -a x86 -o publish --no-restore
run: dotnet publish .\src\SAM\SAM.csproj -c Debug -a x86 -o publish --no-restore /p:VersionPrefix=${{ inputs.version-prefix || env.VERSION_PREFIX }} /p:VersionSuffix=${{ inputs.version-suffix || env.VERSION_SUFFIX }}
- name: Upload a Build Artifact
id: artifact-upload
uses: actions/upload-artifact@v3
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,51 @@ name: Create Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: 'v0.0.1-alpha'
type: string
push:
tags:
- 'v*'

jobs:

setup:
runs-on: windows-latest
permissions:
contents: write
outputs:
version-prefix: ${{ steps.validate-version.outputs.version-prefix }}
version-suffix: ${{ steps.validate-version.outputs.version-suffix }}
steps:
- id: validate-version
name: Validate Version
run: |
# if this is on a release tag push it will use the ref_name, otherwise on
# workflow_dispatch the version is required
$version = '${{ github.ref_name || inputs.version }}'
$version = $version.TrimStart('v')
if ([string]::IsNullOrEmpty($version)) { throw 'A release version was not specified.' }
# TODO: validate the version number format with regex
$parts = $version -split '-',2
$prefix = $parts[0]
$suffix = $parts[1]
echo "version-prefix=$prefix" >> $GITHUB_OUTPUT
echo "version-suffix=$suffix" >> $GITHUB_OUTPUT
build:
uses: syntax-tm/SteamAchievementManager/.github/workflows/build.yml@main
needs: setup
with:
is_release: true
version-prefix: ${{ needs.setup.outputs.version-prefix }}
version-suffix: ${{ needs.setup.outputs.version-suffix }}
create-release:
runs-on: windows-latest
needs: [build]
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.6.0

### 1.0.0-alpha
### 0.6.0-alpha

#### General

Expand Down
Binary file modified resources/sam_icon_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 57c353f

Please sign in to comment.