-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
246 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: EarlyAccess | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
precheck: | ||
if: github.repository == 'jreleaser/helloworld-pascal' && startsWith(github.event.head_commit.message, 'Releasing version') != true | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.vars.outputs.VERSION }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cancel previous run | ||
uses: styfle/cancel-workflow-action@0.12.1 | ||
with: | ||
access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Version | ||
id: vars | ||
shell: bash | ||
run: | | ||
VERSION=$(cat VERSION) | ||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | ||
build: | ||
needs: [ precheck ] | ||
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT') | ||
uses: jreleaser/helloworld-pascal/.github/workflows/reusable-build.yml@main | ||
with: | ||
version: ${{ needs.precheck.outputs.VERSION }} | ||
|
||
release: | ||
needs: [ precheck, build ] | ||
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: artifact-* | ||
merge-multiple: true | ||
path: out/jreleaser/assemble/helloworld/archive | ||
|
||
- name: Release | ||
uses: jreleaser/release-action@v2 | ||
with: | ||
arguments: release | ||
env: | ||
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: JReleaser output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
retention-days: 1 | ||
name: jreleaser-release | ||
path: | | ||
out/jreleaser/trace.log | ||
out/jreleaser/output.properties |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release version' | ||
required: true | ||
|
||
jobs: | ||
precheck: | ||
name: Precheck | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.vars.outputs.VERSION }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Cancel previous run | ||
uses: styfle/cancel-workflow-action@0.12.1 | ||
with: | ||
access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Version | ||
id: vars | ||
shell: bash | ||
run: | | ||
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | ||
build: | ||
needs: [ precheck ] | ||
uses: jreleaser/helloworld-pascal/.github/workflows/reusable-build.yml@main | ||
with: | ||
version: ${{ needs.precheck.outputs.VERSION }} | ||
|
||
release: | ||
name: Release | ||
needs: [ precheck, build ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: artifact-* | ||
merge-multiple: true | ||
path: out/jreleaser/assemble/helloworld/archive | ||
|
||
- name: Commit version | ||
run: | | ||
echo ${{ github.event.inputs.version }} > VERSION | ||
git add VERSION | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "GitHub Action" | ||
git commit -a -m "Releasing version ${{ needs.precheck.outputs.VERSION }}" | ||
git push origin main | ||
- name: Release | ||
uses: jreleaser/release-action@v2 | ||
with: | ||
version: early-access | ||
arguments: release | ||
env: | ||
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: JReleaser output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jreleaser-release | ||
path: | | ||
out/jreleaser/trace.log | ||
out/jreleaser/output.properties |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
version: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build: | ||
name: 'Build ${{ matrix.os }}' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, macos-13] #, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Pascal (Linux) | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
export DEBIAN_FRONTEND=noninteractive | ||
sudo apt-get update | ||
sudo apt-get install -y fpc | ||
- name: Setup Pascal (Osx) | ||
if: ${{ runner.os == 'macOS' }} | ||
run: | | ||
brew install fpc | ||
#- name: Setup Pascal (Windows) | ||
# if: ${{ runner.os == 'Windows' }} | ||
# run: | | ||
# choco install lazarus | ||
|
||
- name: Build | ||
if: ${{ runner.os != 'Windows' }} | ||
run: | | ||
mkdir target | ||
fpc -otarget/helloworld src/helloworld.pas | ||
#- name: Build | ||
# if: ${{ runner.os == 'Windows' }} | ||
# run: | | ||
# mkdir target | ||
# fpc.exe -otarget\helloworld.exe src\helloworld.pas | ||
|
||
- name: Assemble | ||
uses: jreleaser/release-action@v2 | ||
with: | ||
arguments: assemble | ||
env: | ||
JRELEASER_PROJECT_VERSION: ${{ inputs.version }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: JReleaser output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jreleaser-assemble-${{ runner.os }}-${{ runner.arch }} | ||
path: | | ||
out/jreleaser/trace.log | ||
out/jreleaser/output.properties | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
retention-days: 1 | ||
name: artifact-${{ runner.os }}-${{ runner.arch }} | ||
path: | | ||
out/jreleaser/assemble/helloworld/archive/*.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
= Helloworld in Pascal | ||
|
||
ifdef::env-github[] | ||
:tip-caption: :bulb: | ||
:note-caption: :information_source: | ||
:important-caption: :heavy_exclamation_mark: | ||
:caution-caption: :fire: | ||
:warning-caption: :warning: | ||
endif::[] | ||
|
||
This repository shows how to configure link:https://github.com/features/actions[GitHub Actions] and link:https://jreleaser.org/[JReleaser] to: | ||
|
||
* compile a helloworld app for the following targets: | ||
** osx-aarch_64 | ||
** osx-x86_64 | ||
** linux-x86_64 | ||
* assemble zip distributions with JReleaser | ||
* create rolling early-access releases with JReleaser on every push to `main` branch | ||
|
||
IMPORTANT: JReleaser requires 2 additional inputs that may be set as environment variables, `JRELEASER_PROJECT_VERSION` and `JRELEASER_GITHUB_TOKEN`. | ||
More information about environment variable configuration may be found in the link:https://jreleaser.org/guide/latest/reference/environment.html[guide]. |
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