updated how we tag releases and builds
This commit is contained in:
parent
cc9a470213
commit
00c165e0dc
1 changed files with 20 additions and 29 deletions
49
.github/workflows/main.yml
vendored
49
.github/workflows/main.yml
vendored
|
|
@ -45,6 +45,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
filename: "/app/library/version.py"
|
filename: "/app/library/version.py"
|
||||||
placeholder: "dev-master"
|
placeholder: "dev-master"
|
||||||
|
with_date: "true"
|
||||||
with_branch: "true"
|
with_branch: "true"
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
|
@ -93,7 +94,7 @@ jobs:
|
||||||
cache-to: type=gha, scope=${{ github.workflow }}
|
cache-to: type=gha, scope=${{ github.workflow }}
|
||||||
|
|
||||||
- name: Version tag
|
- name: Version tag
|
||||||
if: github.event_name == 'disabled_now'
|
if: github.event_name == 'push'
|
||||||
uses: arabcoders/action-python-autotagger@master
|
uses: arabcoders/action-python-autotagger@master
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -101,9 +102,10 @@ jobs:
|
||||||
path: app/library/version.py
|
path: app/library/version.py
|
||||||
variable: APP_VERSION
|
variable: APP_VERSION
|
||||||
|
|
||||||
|
|
||||||
dockerhub-sync-readme:
|
dockerhub-sync-readme:
|
||||||
needs: push-build
|
needs: push-build
|
||||||
if: github.event_name == 'push'
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Sync README
|
- name: Sync README
|
||||||
|
|
@ -121,12 +123,14 @@ jobs:
|
||||||
create_release:
|
create_release:
|
||||||
needs: push-build
|
needs: push-build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# Only run on master push
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && success()
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && success()
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # so we can git log the full history
|
fetch-depth: 0 # so we can do git log for the full history
|
||||||
|
|
||||||
- name: Get commits between old and new
|
- name: Get commits between old and new
|
||||||
id: commits
|
id: commits
|
||||||
|
|
@ -148,37 +152,24 @@ jobs:
|
||||||
echo "$LOG" >> "$GITHUB_ENV"
|
echo "$LOG" >> "$GITHUB_ENV"
|
||||||
echo "EOF" >> "$GITHUB_ENV"
|
echo "EOF" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- name: Create local tag matching Docker's raw pattern
|
- name: Fetch the most recent tag
|
||||||
id: createtag
|
id: last_tag
|
||||||
run: |
|
run: |
|
||||||
# We'll replicate raw format: branch + base_ref + date + short sha
|
# Make sure we have all tags
|
||||||
# If base_ref is empty (normal push to master, no PR?), it won't appear.
|
git fetch --tags
|
||||||
BRANCH_NAME="${{ github.ref_name }}"
|
|
||||||
BASE_REF="${{ github.base_ref }}"
|
|
||||||
CURRENT_SHA="${{ github.event.after }}"
|
|
||||||
DATE=$(date +%Y%m%d)
|
|
||||||
SHORT_SHA=$(echo "$CURRENT_SHA" | cut -c1-7)
|
|
||||||
|
|
||||||
TAG="${BRANCH_NAME}${BASE_REF}-${DATE}-${SHORT_SHA}"
|
# Get the latest tag by commit date (most recent)
|
||||||
|
# If there are no tags at all, set a fallback
|
||||||
|
LAST_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1) 2>/dev/null || echo "no-tags-found")
|
||||||
|
|
||||||
echo "Using tag: $TAG"
|
echo "Latest tag found: $LAST_TAG"
|
||||||
|
echo "LAST_TAG=$LAST_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
git config user.name "github-actions"
|
- name: Create or update GitHub Release using last tag
|
||||||
git config user.email "github-actions@github.com"
|
|
||||||
|
|
||||||
# Create a lightweight local tag
|
|
||||||
git tag "$TAG" "$CURRENT_SHA"
|
|
||||||
|
|
||||||
# Push the tag back to GitHub
|
|
||||||
git push origin "$TAG"
|
|
||||||
|
|
||||||
# Expose as an output
|
|
||||||
echo "TAG=$TAG" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Create GitHub Release
|
|
||||||
uses: softprops/action-gh-release@master
|
uses: softprops/action-gh-release@master
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.createtag.outputs.TAG }}
|
tag_name: ${{ steps.last_tag.outputs.LAST_TAG }}
|
||||||
name: "${{ steps.createtag.outputs.TAG }}"
|
name: "${{ steps.last_tag.outputs.LAST_TAG }}"
|
||||||
body: ${{ env.LOG }}
|
body: ${{ env.LOG }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue