Better tag matching (#243)
* Better tag matching * Split PR and release flows * Undo PR archiving
This commit is contained in:
committed by
GitHub
parent
ddb2952e64
commit
67f58a39aa
21
.github/workflows/build-pr.yaml
vendored
Normal file
21
.github/workflows/build-pr.yaml
vendored
Normal 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
|
||||||
41
.github/workflows/release.yaml
vendored
41
.github/workflows/release.yaml
vendored
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user