Better tag matching (#243)

* Better tag matching

* Split PR and release flows

* Undo PR archiving
This commit is contained in:
Christiaan Goossens
2026-04-14 14:17:09 +02:00
committed by GitHub
parent ddb2952e64
commit 67f58a39aa
2 changed files with 46 additions and 16 deletions

21
.github/workflows/build-pr.yaml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Build pull request artifact
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build
run: scripts/build
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
path: ./hass-oidc-auth.zip
archive: false

View File

@@ -1,11 +1,9 @@
name: Build release and add zip file name: Build and upload draft release asset
on: on:
push: release:
tags: types:
- 'v[0-9]+\.[0-9]+\.[0-9]+' - created
pull_request:
jobs: jobs:
release: release:
@@ -16,20 +14,31 @@ jobs:
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.release.target_commitish }}
- name: Create tag if missing
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag_name="${{ github.event.release.tag_name }}"
if git rev-parse --verify --quiet "refs/tags/${tag_name}" >/dev/null; then
echo "Tag ${tag_name} already exists"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "${tag_name}"
git push origin "${tag_name}"
- name: Build - name: Build
run: scripts/build run: scripts/build
- name: Upload Artifact - name: Upload build to draft release
uses: actions/upload-artifact@v7
with:
path: ./hass-oidc-auth.zip
archive: false
if: ${{ github.event_name == 'pull_request' }}
- name: Upload build to existing release
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
gh release upload "${{ github.ref_name }}" ./hass-oidc-auth.zip --clobber gh release upload "${{ github.event.release.tag_name }}" ./hass-oidc-auth.zip --clobber