feat: Add beta-test workflow for Docker build and push #87
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-Release on Version Change | |
on: | |
push: | |
branches: | |
- v3-beta | |
workflow_dispatch: {} | |
jobs: | |
check-version-and-create-release: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the previous commit of the repo | |
- name: Checkout previous commit | |
id: checkout_prev_commit | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.before }} | |
# Get the previous package version from latest | |
- name: Get previous package version | |
id: get_prev_version | |
run: echo "::set-output name=prev_version::$(cat latest)" | |
# Checkout the current commit of the repo | |
- name: Checkout current commit | |
id: checkout_current_commit | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.sha }} | |
# Get the current package version from latest | |
- name: Get current package version | |
id: get_current_version | |
run: echo "::set-output name=current_version::$(cat latest)" | |
# Compare the previous and current versions | |
- name: Compare versions | |
id: compare_versions | |
run: | | |
if [[ "${{ steps.get_prev_version.outputs.prev_version }}" != "${{ steps.get_current_version.outputs.current_version }}" ]]; then | |
echo "Version changed. Creating Pre-Release." | |
echo "New version: ${{ steps.get_current_version.outputs.current_version }}, Previous version: ${{ steps.get_prev_version.outputs.prev_version }}" | |
echo "::set-output name=version_changed::true" | |
else | |
echo "Version unchanged. No Pre-Release needed." | |
echo "::set-output name=version_changed::false" | |
fi | |
# Generate Release Notes | |
- name: Generate Release Notes | |
id: generate_release_notes | |
run: | | |
echo "::set-output name=release_notes::$(git log --pretty=format:"- %s%n" $(git rev-list ${{ github.event.before }}..${{ github.sha }}))" | |
# Create Pre-Release | |
- name: Create Pre-Release | |
if: steps.compare_versions.outputs.version_changed == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Create a new Pre-Release using GitHub API | |
# Replace ":owner", ":repo", and other placeholders with actual values | |
# You can use curl or other tools to interact with the API | |
curl -X POST \ | |
-H "Authorization: token $GITHUB_TOKEN" \ | |
-d '{ | |
"tag_name": "'${{ steps.get_current_version.outputs.current_version }}'", | |
"target_commitish": "v3-beta", | |
"name": "Pre-Release V'${{ steps.get_current_version.outputs.current_version }}'", | |
"body": "${{ steps.generate_release_notes.outputs.release_notes }}", | |
"prerelease": true | |
}' \ | |
"https://api.github.com/repos/wizarrrr/wizarr/releases" |