135 lines
5.4 KiB
YAML
135 lines
5.4 KiB
YAML
name: Create GitHub Pre-Release after GitLab tag mirror
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
|
|
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
|
|
- '[0-9]+.[0-9]+.[0-9]+-pre.[0-9]+'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# GET THE LATEST CODE
|
|
- name: Checkout latest code
|
|
uses: actions/checkout@master
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# EXTRACT TAG FROM PUSH
|
|
- name: Get tag
|
|
id: tag
|
|
uses: dawidd6/action-get-tag@v1
|
|
- name: Use tag
|
|
run: echo ${{steps.tag.outputs.tag}}
|
|
|
|
# GENERATE CHANGELOG, RELEASE
|
|
- id: conventional_changelog
|
|
uses: ardalanamini/auto-changelog@master
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@latest
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{steps.tag.outputs.tag}}
|
|
body: |
|
|
Automatic pre-release of version: **${{steps.tag.outputs.tag}}**
|
|
**Changes in this pre-release:**
|
|
${{ steps.conventional_changelog.outputs.changelog }}
|
|
draft: false
|
|
prerelease: true
|
|
|
|
# BUILD PROJECT AND PUBLISH TO PACKAGES
|
|
- name: Set up JDK 8
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: 'adopt'
|
|
java-version: '8'
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
- name: Publish to GitHub Packages
|
|
env:
|
|
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
./gradlew build -Pversion=${{steps.tag.outputs.tag}} --info --no-daemon -x test
|
|
- name: List files
|
|
run: ls -ahl build/libs
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-artifacts-gradle
|
|
path: |
|
|
build/libs/
|
|
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
- uses: actions/upload-artifact@v3
|
|
if: failure()
|
|
with:
|
|
name: report
|
|
path: build/reports/tests/test/
|
|
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
|
|
|
|
# UPLOAD ASSETS TO RELEASE
|
|
- name: Upload Release Asset Main Jar
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./build/libs/VersionChecker-${{steps.tag.outputs.tag}}.jar
|
|
asset_name: VersionChecker-${{steps.tag.outputs.tag}}.jar
|
|
asset_content_type: application/jar
|
|
|
|
- name: Upload Release Asset Sources Jar
|
|
id: upload-release-asset-sources
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./build/libs/VersionChecker-${{steps.tag.outputs.tag}}-sources.jar
|
|
asset_name: VersionChecker-${{steps.tag.outputs.tag}}-sources.jar
|
|
asset_content_type: application/jar
|
|
|
|
- name: Upload Release Asset Javadoc Jar
|
|
id: upload-release-asset-javadoc
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./build/libs/VersionChecker-${{steps.tag.outputs.tag}}-javadoc.jar
|
|
asset_name: VersionChecker-${{steps.tag.outputs.tag}}-javadoc.jar
|
|
asset_content_type: application/jar
|
|
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "::set-output name=today::$(date +'%Y-%m-%dT%H:%M:%S')"
|
|
- name: Post WebHook Message
|
|
run: |
|
|
curl -L --output ./discord.sh https://raw.githubusercontent.com/ChaoticWeg/discord.sh/master/discord.sh
|
|
chmod a+x ./discord.sh
|
|
./discord.sh \
|
|
--webhook-url="${{ secrets.WEBHOOK_URL }}" \
|
|
--username "$GITHUB_REPOSITORY" \
|
|
--avatar "https://i.griefed.de/images/2020/11/18/Prosper_Docker_300x300.png" \
|
|
--text "There's been a new release for $GITHUB_REPOSITORY. The new version is ${{steps.tag.outputs.tag}} and is available at <$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{steps.tag.outputs.tag}}>" \
|
|
--title "New $GITHUB_REPOSITORY Release" \
|
|
--description "There's been a new release for $GITHUB_REPOSITORY. The new version is ${{steps.tag.outputs.tag}} and is available at $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{steps.tag.outputs.tag}}" \
|
|
--color "0xC0FFEE" \
|
|
--url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/${{steps.tag.outputs.tag}}" \
|
|
--author "Griefed" \
|
|
--author-url "$GITHUB_SERVER_URL/Griefed" \
|
|
--author-icon "https://i.griefed.de/images/2022/01/21/sam_1500x1500.th.jpg" \
|
|
--thumbnail "https://i.griefed.de/images/2020/11/18/Prosper_Docker_300x300.th.png" \
|
|
--field "Author;[Griefed]($GITHUB_SERVER_URL/Griefed)" \
|
|
--field "Platform;[GitHub]($GITHUB_SERVER_URL)" \
|
|
--footer "Released at ${{ steps.date.outputs.today }}" \
|
|
--footer-icon "https://i.griefed.de/images/2022/01/21/start_generation.png"
|