Skip to content

Commit

Permalink
add CI to build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Jul 22, 2022
1 parent cf7883d commit 5a5cf1c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build and release

on:
workflow_dispatch:
inputs:
release_made:
description: "I have update the release/RELEASE.md file to describe the release."
required: true
type: boolean

jobs:
check_release:
name: Check input parameters
if: ${{ !inputs.release_made }}
runs-on: ubuntu-latest
steps:
- run: echo "Release check wasn't checked"
build:
name: 🏗️ Building project
if: ${{ inputs.release_made }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version_get.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: 🗝️ update permissions
run: chmod u+x gradlew
- name: ⚙️ get version
id: version_get
run: echo "::set-output name=version::$(scripts/get_version.sh)"
- name: ⚙️ Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
- name: 🏗️ Compile wiki-changes
run: ./gradlew shadowJar
- name: ⚙️ Move compiled jar
run: mv ./build/libs/wikidata-changes-*-all.jar wiki-changes.jar
- name: ☁️ Upload artifact
uses: actions/upload-artifact@v3
with:
name: "wiki-changes.jar"
path: "wiki-changes.jar"
create_release:
name: 🚀 Create Github release
environment:
name: release
url: "https://github.com/the-qa-company/wiki-changes/releases/tag/v${{ needs.build.outputs.version }}"
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ☁️ Download artifacts
uses: actions/download-artifact@v3
- name: ⚙️ Extract artifacts
run: |
mkdir -p deploy_file
mv wiki-changes.jar/* deploy_file
- name: 🚀 Create release with artifacts
uses: ncipollo/release-action@v1
with:
commit: ${{ github.sha }}
tag: "v${{ needs.build.outputs.version }}"
artifacts: "deploy_file/*"
name: "Release ${{ needs.build.outputs.version }}"
bodyFile: "release/RELEASE.md"
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.the-qa-company'
version '0.1-SNAPSHOT'
version '0.1.0-SNAPSHOT'

repositories {
mavenCentral()
Expand Down Expand Up @@ -39,3 +39,9 @@ dependencies {
test {
useJUnitPlatform()
}

tasks.register("printVersion") {
doLast {
println(rootProject.version)
}
}
3 changes: 3 additions & 0 deletions release/RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Changelog 📓**

- Release wiki-changes.jar
7 changes: 7 additions & 0 deletions scripts/get_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

BASE=`dirname $0`

cd $BASE/..

./gradlew printVersion -q

0 comments on commit 5a5cf1c

Please sign in to comment.