Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 61 additions & 15 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,79 @@
# Package and Upload a release.zip
# See https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven

name: Publish release

on:
push:
branches: [ "master" ]
# Allows you to manually run the workflow (for testing)
workflow_dispatch:
inputs:
version_bump:
description: 'Version bump type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major

concurrency:
group: release
cancel-in-progress: true

jobs:
build:
name: Build and package Aya
runs-on: ubuntu-latest
permissions:
checks: write
contents: read
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Use PAT if you have one to avoid triggering workflows on push
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK 11
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Run install phase
run: mvn install --batch-mode
- name: Publish the artifact
uses: actions/upload-artifact@v4

# Verify build works before bumping version
- name: Run tests
run: mvn test --batch-mode

- name: Build package
run: mvn package --batch-mode -DskipTests

# Increment patch version in pom.xml
- name: Bump version
run: |
mvn build-helper:parse-version versions:set \
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} \
versions:commit

- name: Get new version
id: version
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT

# Update hardcoded version string in source file
- name: Update version in source
run: |
sed -i 's/VERSION_NAME = "[0-9.]*"/VERSION_NAME = "${{ steps.version.outputs.version }}"/' src/aya/StaticData.java

# Commit both pom.xml and source file changes, create tag
- name: Commit and tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pom.xml src/
git commit -m "Release v${{ steps.version.outputs.version }}"
git tag "v${{ steps.version.outputs.version }}"
git push origin HEAD --tags

- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: aya.zip
path: target/aya-*.zip
tag_name: v${{ steps.version.outputs.version }}
name: Release v${{ steps.version.outputs.version }}
files: target/aya-*.zip
generate_release_notes: true
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>co.npaul.aya</groupId>
<artifactId>aya</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
Expand Down Expand Up @@ -107,6 +107,13 @@
</executions>
</plugin>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
</plugin>

</plugins>
</build>

Expand Down
2 changes: 1 addition & 1 deletion src/aya/StaticData.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class StaticData {

public static final boolean DEBUG = true;
public static final String VERSION_NAME = "v0.6.0";
public static final String VERSION_NAME = "0.7.0";
public static final String ayarcPath = "ayarc.aya";
public static final boolean PRINT_LARGE_ERRORS = true;
public static final String QUIT = "\\Q";
Expand Down