Add release pipeline
This commit is contained in:
77
.github/workflows/release.yml
vendored
Normal file
77
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v**"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Get tag name
|
||||||
|
uses: olegtarasov/get-tag@v2.1
|
||||||
|
id: tagName
|
||||||
|
- name: Validate semver
|
||||||
|
run: |
|
||||||
|
echo $GIT_TAG_NAME | grep -oP '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Validate Gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
- name: Setup JDK 17
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 17
|
||||||
|
- name: Make Gradle wrapper executable
|
||||||
|
if: ${{ runner.os != 'Windows' }}
|
||||||
|
run: chmod +x ./gradlew
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE: ${{ steps.tagName.outputs.tag }}
|
||||||
|
- name: Build documentation
|
||||||
|
run: ./gradlew javadoc
|
||||||
|
env:
|
||||||
|
RELEASE: ${{ steps.tagName.outputs.tag }}
|
||||||
|
- name: Publish documentation
|
||||||
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
||||||
|
with:
|
||||||
|
branch: gh-pages
|
||||||
|
folder: build/docs/javadoc
|
||||||
|
- name: Publish
|
||||||
|
run: ./gradlew publish
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
RELEASE: ${{ steps.tagName.outputs.tag }}
|
||||||
|
- name: Retrieve changelog
|
||||||
|
id: changelog_reader
|
||||||
|
uses: mindsers/changelog-reader-action@v2
|
||||||
|
with:
|
||||||
|
version: 'Unreleased'
|
||||||
|
path: ./CHANGELOG.md
|
||||||
|
- name: Release on GitHub
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
id: ghRelease
|
||||||
|
with:
|
||||||
|
body: ${{ steps.changelog_reader.outputs.changes }}
|
||||||
|
name: ${{ steps.tagName.outputs.tag }}
|
||||||
|
files: |
|
||||||
|
build/libs/*.jar
|
||||||
|
# This is necessary because the Discord action doesn't support GH actions variable expansion?
|
||||||
|
- name: Set release URL
|
||||||
|
run: |
|
||||||
|
echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV
|
||||||
|
- name: Notify Discord
|
||||||
|
uses: Ilshidur/action-discord@0.3.2
|
||||||
|
with:
|
||||||
|
args: 'Refined Storage {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}'
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
- name: Notify Twitter
|
||||||
|
uses: ethomson/send-tweet-action@v1
|
||||||
|
with:
|
||||||
|
status: Refined Storage ${{ env.GIT_TAG_NAME }} has been released! ${{ env.RELEASE_URL }}
|
||||||
|
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
|
||||||
|
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
|
||||||
|
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
|
||||||
|
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
|
18
build.gradle
18
build.gradle
@@ -126,3 +126,21 @@ jar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar.finalizedBy('reobfJar')
|
jar.finalizedBy('reobfJar')
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "GitHubPackages"
|
||||||
|
url = uri("https://maven.pkg.github.com/refinedmods/refinedstorage")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("GITHUB_ACTOR")
|
||||||
|
password = System.getenv("GITHUB_TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publications {
|
||||||
|
gpr(MavenPublication) {
|
||||||
|
from(components.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user