Skip to content

Commit

Permalink
updated github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-clark-8192 committed Apr 24, 2024
1 parent 0648268 commit ef16f9e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 19 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ on:
workflow_dispatch:
inputs:
ref:
description: 'Example: refs/tags/v1.0.0'
description: 'Example: refs/tags/v1.0.0-test'
default: 'refs/tags/v1.0.0-test'
required: true
ref_name:
description: 'Example: v1.0.0-test'
default: 'v1.0.0-test'
required: true
default: 'refs/tags/v1.0.0-test6'


jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_REF: ${{ github.event.inputs.ref_name }}
GITHUB_REF_NAME: ${{ github.event.inputs.ref_short_name }}
GITHUB_REF: ${{ github.event.inputs.ref }}
GITHUB_REF_NAME: ${{ github.event.inputs.ref_name }}
steps:
- name: Check out code
uses: actions/checkout@v4
Expand Down
47 changes: 33 additions & 14 deletions .github/workflows/release-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]-*'
env:
# Pre-declare variables defined by step id: version-info
# Pre-declare variables defined by step id: build-vars
REPO_OWNER: ''
REPO_NAME: ''
VERSION: ''
PRERELEASE: ''
HAS_PRERELEASE: ''
Expand All @@ -22,33 +24,50 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get version info from tag
id: version-info
- name: Define build variables
id: build-vars
run: |
#######################################################
# REPO_OWNER and REPO_NAME
#######################################################
echo "GITHUB_REPOSITORY: $env:GITHUB_REPOSITORY"
$REPO_PATTERN = '^(.*)/(.*)$'
if ($env:GITHUB_REPOSITORY -match $REPO_PATTERN) {
$REPO_OWNER = $matches[1]
$REPO_NAME = $matches[2]
} else {
throw "Unsupported repository format: $env:GITHUB_REPOSITORY"
}
echo "REPO_OWNER=$REPO_OWNER" >> $env:GITHUB_ENV
echo "REPO_NAME=$REPO_NAME" >> $env:GITHUB_ENV
#######################################################
# VERSION, PRERELEASE, HAS_PRERELEASE
#######################################################
echo "GITHUB_REPOSITORY: $env:GITHUB_REPOSITORY"
echo "GITHUB_REF_NAME: $env:GITHUB_REF_NAME"
$VERSION_PATTERN = '^v?(\d+\.\d+\.\d+)(?:-(.*))?$'
$REPO_PATTERN = '^(.*)/(.*)$'
if ($env:GITHUB_REF_NAME -match $VERSION_PATTERN) {
$VERSION = $matches[1]
$PRERELEASE = $matches[2]
$HAS_PRERELEASE = $PRERELEASE ? "true" : "false"
} else {
throw "Unsupported version format: $env:GITHUB_REF_NAME"
}
$RELEASE_ZIP = "noconsole-win-$env:GITHUB_REF_NAME.zip"
Tee-Object -Append $env:GITHUB_ENV -In "VERSION=$VERSION"
Tee-Object -Append $env:GITHUB_ENV -In "PRERELEASE=$PRERELEASE"
Tee-Object -Append $env:GITHUB_ENV -In "HAS_PRERELEASE=$HAS_PRERELEASE"
Tee-Object -Append $env:GITHUB_ENV -In "RELEASE_ZIP=$RELEASE_ZIP"
echo "VERSION=$VERSION" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "HAS_PRERELEASE=$HAS_PRERELEASE" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "RELEASE_ZIP=$RELEASE_ZIP" | Out-File -Append -FilePath $env:GITHUB_ENV
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
echo "PRERELEASE=$PRERELEASE" >> $env:GITHUB_ENV
echo "HAS_PRERELEASE=$HAS_PRERELEASE" >> $env:GITHUB_ENV
#######################################################
# RELEASE_ZIP
#######################################################
$RELEASE_ZIP = "$REPO_NAME-$VERSION.zip"
echo "RELEASE_ZIP=$RELEASE_ZIP" >> $env:GITHUB_ENV
#######################################################
# Display newly defined variables
#######################################################
Get-Content $env:GITHUB_ENV
- name: Set version in AssemblyInfo.cs files
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# local (non-committed) files
local.*

# User-specific files
*.rsuser
*.suo
Expand Down

0 comments on commit ef16f9e

Please sign in to comment.