Skip to content

Commit

Permalink
build: Add GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Jan 5, 2025
1 parent 1cde3d9 commit 531388c
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/early-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: EarlyAccess

on:
push:
branches: [ main ]

jobs:
precheck:
if: github.repository == 'jreleaser/helloworld-bun' && 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/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Version
id: vars
shell: bash
run: |
echo "VERSION=$(cat VERSION)" >> $GITHUB_OUTPUT
release:
needs: [ precheck ]
if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT')
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Assemble
uses: jreleaser/release-action@v2
with:
arguments: assemble
env:
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: JReleaser assemble output
if: always()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: jreleaser-assemble
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
- 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 release output
if: always()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
71 changes: 71 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cancel previous run
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- 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 ${{ github.event.inputs.version }}"
git push origin main
- name: Assemble
uses: jreleaser/release-action@v2
with:
arguments: assemble
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: JReleaser assemble output
if: always()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: jreleaser-assemble
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
- name: Release
uses: jreleaser/release-action@v2
with:
arguments: release
env:
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: jreleaser-release
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties

0 comments on commit 531388c

Please sign in to comment.