commit
71e7306849
|
@ -1,106 +0,0 @@
|
|||
name: Auto Create Pre-Release Version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
get_date:
|
||||
name: Get date for release version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
today: ${{ steps.get_today.outputs.NOW }}
|
||||
steps:
|
||||
- name: Set current date as env variable
|
||||
id: get_today
|
||||
run: echo "NOW=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
|
||||
- name: Echo current date
|
||||
run: echo ${{ steps.get_today.outputs.NOW }}
|
||||
|
||||
check_merged:
|
||||
name: Check if latest merged commit is less than 24h
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should_run: ${{ steps.should_run.outputs.SHOULD_RUN }}
|
||||
merged_sha: ${{ steps.merged_sha.outputs.MERGED_SHA }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Get latest merged SHA if less than a day
|
||||
id: merged_sha
|
||||
run: echo "MERGED_SHA=$(git log -n 1 --merges --after="24 hours" --pretty=format:"%H")" >> $GITHUB_OUTPUT
|
||||
- name: Check latest merged SHA if less than a day
|
||||
id: should_run
|
||||
run: |
|
||||
echo ${{ steps.merged_sha.outputs.MERGED_SHA }}
|
||||
if [ ${{ steps.merged_sha.outputs.MERGED_SHA }} != "" ]; then
|
||||
echo "Latest Merged SHA: ${{ steps.merged_sha.outputs.MERGED_SHA }}"
|
||||
echo "SHOULD_RUN=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "No merged on last 24h"
|
||||
echo "SHOULD_RUN=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
build:
|
||||
name: Create Release Asset
|
||||
needs: [get_date, check_merged]
|
||||
if: ${{ needs.check_merged.outputs.should_run == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Echo env
|
||||
run: |
|
||||
echo "merged_sha: ${{ needs.check_merged.outputs.merged_sha }}"
|
||||
echo "should_run: ${{ needs.check_merged.outputs.should_run }}"
|
||||
echo "today: ${{ needs.get_date.outputs.today }}"
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: 'true'
|
||||
|
||||
- name: Get Current Latest Tag
|
||||
uses: actions-ecosystem/action-get-latest-tag@v1
|
||||
id: previoustag
|
||||
|
||||
- name: Format New Tag
|
||||
id: new_tag
|
||||
run: |
|
||||
if [[ ${{ steps.previoustag.outputs.tag }} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo newtag=${BASH_REMATCH[0]} >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Something is wrong with the version"
|
||||
fi
|
||||
- name: Overwrite Version.txt file
|
||||
uses: "DamianReeves/write-file-action@master"
|
||||
with:
|
||||
path: Winget-AutoUpdate/Version.txt
|
||||
write-mode: overwrite
|
||||
contents: "${{ steps.new_tag.outputs.newtag }}.${{ needs.get_date.outputs.today }}"
|
||||
|
||||
- name: Commit & Push
|
||||
uses: actions-js/push@v1.4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: main
|
||||
force: true
|
||||
message: 'Changed version to ${{ steps.new_tag.outputs.newtag }}.${{ needs.get_date.outputs.today }}'
|
||||
|
||||
- name: Build project
|
||||
run: |
|
||||
zip -r WAU Winget-AutoUpdate/*
|
||||
zip -r WAU Winget-AutoUpdate-Install.ps1
|
||||
zip -r WAU excluded_apps.txt
|
||||
zip -r WAU install.bat
|
||||
zip -r WAU uninstall.bat
|
||||
|
||||
- name: Create release
|
||||
uses: "ncipollo/release-action@v1"
|
||||
with:
|
||||
tag: "v${{ steps.new_tag.outputs.newtag }}.${{ needs.get_date.outputs.today }}"
|
||||
prerelease: true
|
||||
generateReleaseNotes: true
|
||||
name: "v${{ steps.new_tag.outputs.newtag }}-${{ needs.get_date.outputs.today }} [Nightly Build]"
|
||||
artifacts: "WAU.zip"
|
|
@ -0,0 +1,103 @@
|
|||
name: Auto Create Pre-Release Version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
check_merged:
|
||||
name: Compare latest merge and tag
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should_run: ${{ steps.should_run.outputs.SHOULD_RUN }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Check if latest merged is older than latest tag
|
||||
id: should_run
|
||||
run: |
|
||||
echo "Latest tag:"
|
||||
git log --tags --pretty="%ci - %h - %s %d" -n 1
|
||||
LATEST_TAG_DATE=$(git log --tags -n 1 --pretty="%ct")
|
||||
echo $LATEST_TAG_DATE
|
||||
|
||||
echo "Latest merge:"
|
||||
git log --merges --pretty="%ci - %h - %s %d" -n 1
|
||||
LATEST_MERGE_DATE=$(git log --merges -n 1 --pretty="%ct")
|
||||
echo $LATEST_MERGE_DATE
|
||||
|
||||
if [[ $LATEST_MERGE_DATE -gt $LATEST_TAG_DATE ]]; then
|
||||
echo "Latest tag is older than latest merge. Nightly will be created."
|
||||
echo "SHOULD_RUN=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Latest merge is not older than latest tag. No new release needed."
|
||||
echo "SHOULD_RUN=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
build:
|
||||
name: Create Release Asset
|
||||
needs: [check_merged]
|
||||
if: ${{ needs.check_merged.outputs.should_run == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: 'true'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Auto Increment Semver Action
|
||||
uses: MCKanpolat/auto-semver-action@1.0.9
|
||||
id: versioning
|
||||
with:
|
||||
releaseType: prerelease
|
||||
incrementPerCommit: false
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Next Release Number
|
||||
id: WAU_version
|
||||
run: |
|
||||
echo "Next Release version: ${{ steps.versioning.outputs.version }}"
|
||||
echo "PowerShell format version: ${{ steps.versioning.outputs.version }}" | tr '-' '.'
|
||||
echo PSVersion=$(echo '${{ steps.versioning.outputs.version }}' | tr '-' '.') >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Overwrite Version.txt file
|
||||
uses: DamianReeves/write-file-action@v1.2
|
||||
with:
|
||||
path: Winget-AutoUpdate/Version.txt
|
||||
write-mode: overwrite
|
||||
contents: ${{ steps.WAU_version.outputs.PSVersion }}
|
||||
|
||||
- name: Commit & Push
|
||||
uses: actions-js/push@v1.4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: main
|
||||
force: true
|
||||
message: 'Changed version to ${{ steps.versioning.outputs.version }}'
|
||||
|
||||
- name: Build project
|
||||
run: |
|
||||
zip -r WAU Winget-AutoUpdate/*
|
||||
zip -r WAU Winget-AutoUpdate-Install.ps1
|
||||
zip -r WAU excluded_apps.txt
|
||||
zip -r WAU install.bat
|
||||
zip -r WAU uninstall.bat
|
||||
|
||||
- name: Create release
|
||||
uses: "ncipollo/release-action@v1"
|
||||
id: release
|
||||
with:
|
||||
tag: "v${{ steps.versioning.outputs.version }}"
|
||||
prerelease: true
|
||||
generateReleaseNotes: true
|
||||
name: "v${{ steps.versioning.outputs.version }} [Nightly Build]"
|
||||
artifacts: "WAU.zip"
|
||||
|
||||
- name: URL to release
|
||||
run: echo "Release -> ${{ steps.release.outputs.html_url }}"
|
|
@ -0,0 +1,68 @@
|
|||
name: Create New Version
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
type: choice
|
||||
description: Select next release type
|
||||
options:
|
||||
- Patch
|
||||
- Minor
|
||||
- Major
|
||||
pre-release:
|
||||
type: boolean
|
||||
description: Set as Pre-release version
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Create Release Asset
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: 'true'
|
||||
|
||||
- name: Auto Increment Semver Action
|
||||
uses: MCKanpolat/auto-semver-action@1.0.9
|
||||
id: versioning
|
||||
with:
|
||||
releaseType: ${{ github.event.inputs.version }}
|
||||
incrementPerCommit: false
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Overwrite Version.txt file
|
||||
uses: DamianReeves/write-file-action@v1.2
|
||||
with:
|
||||
path: Winget-AutoUpdate/Version.txt
|
||||
write-mode: overwrite
|
||||
contents: "${{ steps.versioning.outputs.version }}"
|
||||
|
||||
- name: Commit & Push
|
||||
uses: actions-js/push@v1.4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: main
|
||||
force: true
|
||||
message: 'Changed version to ${{ steps.versioning.outputs.version }}'
|
||||
|
||||
- name: Build project
|
||||
run: |
|
||||
zip -r WAU Winget-AutoUpdate/*
|
||||
zip -r WAU Winget-AutoUpdate-Install.ps1
|
||||
zip -r WAU excluded_apps.txt
|
||||
zip -r WAU install.bat
|
||||
zip -r WAU uninstall.bat
|
||||
|
||||
- name: Create release
|
||||
uses: "ncipollo/release-action@v1"
|
||||
with:
|
||||
tag: "v${{ steps.versioning.outputs.version }}"
|
||||
prerelease: ${{ github.event.inputs.pre-release }}
|
||||
generateReleaseNotes: true
|
||||
name: "v${{ steps.versioning.outputs.version }}"
|
||||
artifacts: "WAU.zip"
|
Loading…
Reference in New Issue