Deploy to release by @easystartup-io #73
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: Create release | |
run-name: Deploy to release by @${{ github.actor }} | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build_release: | |
name: Publish zip | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check for changes outside 'docs' directory | |
id: check_changes | |
run: | | |
if git diff-tree --name-only --no-commit-id ${{ github.sha }} | grep -vE '^docs' | grep -q '.'; then | |
echo "changes_made=yes" >> "$GITHUB_ENV" | |
else | |
echo "changes_made=no" >> "$GITHUB_ENV" | |
fi | |
- name: Get next version | |
if: ${{env.changes_made == 'yes'}} | |
uses: reecetech/[email protected] | |
id: version | |
with: | |
scheme: calver | |
- name: Find and Replace | |
if: ${{env.changes_made == 'yes'}} | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "version.*" | |
replace: "version=${{ steps.version.outputs.v-version }}" | |
regex: true | |
include: "src/main/resources/version.properties" | |
- uses: actions/setup-java@v3 | |
if: ${{env.changes_made == 'yes'}} | |
with: | |
java-version: '21' | |
distribution: 'oracle' | |
- run: ./gradlew clean createTar --no-daemon | |
if: ${{env.changes_made == 'yes'}} | |
- name: Publish new version | |
if: ${{env.changes_made == 'yes'}} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.PAT }} | |
file: "build/distributions/k3s-simplified.tar.gz" | |
tag: ${{ steps.version.outputs.v-version }} | |
overwrite: true | |
body: "Auto creating the tar for ${{ github.sha }}" | |
- id: job_successful | |
if: ${{env.changes_made == 'yes'}} | |
run: echo "job_successful=yes" >> "$GITHUB_OUTPUT" |