224 lines
7.1 KiB
YAML
224 lines
7.1 KiB
YAML
name: Application
|
|
|
|
on: [push, pull_request]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 1.8
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: 8
|
|
cache: "gradle"
|
|
|
|
- name: Check license headers
|
|
run: ./gradlew checkLicenses
|
|
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
needs: ci
|
|
strategy:
|
|
matrix:
|
|
java-version: ["8", "11", "17", "20"] # LTS + Latest
|
|
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
|
name: Java ${{ matrix.java-version }} (${{ matrix.os }}) Tests
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK ${{ matrix.java-version }}
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: ${{ matrix.java-version }}
|
|
cache: "gradle"
|
|
|
|
- name: Run Unit Tests
|
|
run: ./gradlew --no-daemon test --tests com.aclauncher.*
|
|
|
|
- name: Run UI Tests
|
|
uses: coactions/setup-xvfb@v1
|
|
continue-on-error: true
|
|
with:
|
|
run: ./gradlew --no-daemon test --tests ui.*
|
|
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
needs: ci
|
|
strategy:
|
|
matrix:
|
|
java-version: ["8", "11", "17", "20"] # LTS + Latest
|
|
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
|
|
name: Java ${{ matrix.java-version }} (${{ matrix.os }}) Build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK ${{ matrix.java-version }}
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: ${{ matrix.java-version }}
|
|
cache: "gradle"
|
|
|
|
- name: Build
|
|
run: ./gradlew build -x test
|
|
|
|
package:
|
|
runs-on: ubuntu-latest
|
|
needs: ci
|
|
outputs:
|
|
version: ${{ steps.version.outputs.text }}
|
|
clean-version: ${{ steps.clean-version.outputs.replaced }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 1.8
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: "temurin"
|
|
java-version: 8
|
|
cache: "gradle"
|
|
|
|
- name: Read version
|
|
id: version
|
|
uses: pCYSl5EDgo/cat@cde404f088c582552b0fe4e24ecb3159445fde2a
|
|
with:
|
|
path: ./src/main/resources/version
|
|
trim: true
|
|
|
|
- name: Remove stream from version
|
|
id: clean-version
|
|
uses: frabert/replace-string-action@v2
|
|
with:
|
|
string: ${{ steps.version.outputs.text }}
|
|
pattern: '([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.?\w*'
|
|
replace-with: "$1"
|
|
|
|
- name: Build
|
|
run: ./gradlew build -x test
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ATLauncher
|
|
path: dist/*
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [test, build, package]
|
|
if: ${{ github.ref == 'refs/heads/master' && !endsWith(needs.package.outputs.version, '.Beta') }}
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Download built artifacts
|
|
uses: actions/download-artifact@v3
|
|
|
|
- name: Read changelog
|
|
id: changelog
|
|
uses: pCYSl5EDgo/cat@cde404f088c582552b0fe4e24ecb3159445fde2a
|
|
with:
|
|
path: ./CHANGELOG.md
|
|
|
|
- name: Remove the top part of the changelog
|
|
id: remove-top-of-changelog
|
|
uses: frabert/replace-string-action@v2
|
|
with:
|
|
string: ${{ steps.changelog.outputs.text }}
|
|
pattern: '^.*?(### (New Features|Fixes|Misc)\n.*)$'
|
|
replace-with: "$1"
|
|
flags: gs
|
|
|
|
- name: Clean up the changelog to only have used sections
|
|
id: clean-changelog
|
|
run: |
|
|
awk '/^$/ {if (i) {b=b $0 "\n"} else {print $0 }; next} /^###/ {i=1; b=$0; next} {if (i) {print b}; i=0; print $0; next}' <<'EOF' > fixed-changelog.md
|
|
${{ steps.remove-top-of-changelog.outputs.replaced }}
|
|
EOF
|
|
echo 'cleaned-changelog<<EOF' >> $GITHUB_ENV
|
|
cat fixed-changelog.md >> $GITHUB_ENV
|
|
echo 'EOF' >> $GITHUB_ENV
|
|
|
|
- name: Create ATLauncher Version
|
|
uses: ATLauncher/release-aclauncher-action@master
|
|
timeout-minutes: 30
|
|
with:
|
|
api-key: ${{ secrets.ATLAUNCHER_API_KEY }}
|
|
version: ${{ needs.package.outputs.clean-version }}
|
|
changelog: ${{ env.cleaned-changelog }}
|
|
files: |
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.exe
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.zip
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.jar
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag_name: v${{ needs.package.outputs.clean-version }}
|
|
target_commitish: master
|
|
name: ${{ needs.package.outputs.clean-version }}
|
|
body: ${{ env.cleaned-changelog }}
|
|
prerelease: false
|
|
draft: false
|
|
files: |
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.exe
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.zip
|
|
./ATLauncher/ATLauncher-${{ needs.package.outputs.clean-version }}.jar
|
|
|
|
- name: Create Sentry release
|
|
uses: getsentry/action-release@v1
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
|
with:
|
|
environment: production
|
|
version: "${{ needs.package.outputs.clean-version }}"
|
|
|
|
- name: Update version
|
|
run: |
|
|
NEW_VERSION=`echo ${{ needs.package.outputs.clean-version }} | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e'`
|
|
cat <<EOF > CHANGELOG.md
|
|
# Changelog
|
|
|
|
This changelog only contains the changes that are unreleased. For changes for individual releases, please visit the
|
|
[releases](https://github.com/ATLauncher/ATLauncher/releases) page on GitHub.
|
|
|
|
## $NEW_VERSION
|
|
|
|
### New Features
|
|
|
|
### Fixes
|
|
|
|
### Misc
|
|
EOF
|
|
echo "${NEW_VERSION}.Beta" > src/main/resources/version
|
|
|
|
- name: Commit new version/CHANGELOG file
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
add: "CHANGELOG.md src/main/resources/version"
|
|
message: "chore: bump version"
|
|
|
|
- name: Add comment, remove label and then close issues labeled with 'awaiting-release'
|
|
uses: ./.github/actions/label-cleanup
|
|
with:
|
|
label: "awaiting-release"
|
|
comment: "This has been fixed with version ${{ needs.package.outputs.clean-version }}"
|
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
|
|
|
- name: Package up AUR versions
|
|
uses: peter-evans/repository-dispatch@v2
|
|
with:
|
|
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
|
event-type: aur-publish
|
|
client-payload: '{"version": "${{ needs.package.outputs.clean-version }}"}'
|