diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index e263ed3..c62566e 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -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 diff --git a/.github/workflows/release-on-tag.yml b/.github/workflows/release-on-tag.yml index 11405a2..f2567db 100644 --- a/.github/workflows/release-on-tag.yml +++ b/.github/workflows/release-on-tag.yml @@ -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: '' @@ -22,11 +24,30 @@ 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] @@ -34,21 +55,19 @@ jobs: } 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 diff --git a/.gitignore b/.gitignore index 6dda6e8..7ffa9f0 100644 --- a/.gitignore +++ b/.gitignore @@ -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