ci: fix artifacts not uploaded #54
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: write | |
jobs: | |
create_changelog: | |
name: Generate changelog | |
runs-on: ubuntu-latest | |
needs: release | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Get previous tag | |
id: previous_tag | |
run: echo "previous_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV | |
- name: Github Release Changelog Generator | |
uses: jaywcjlove/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' | |
custom-emoji: "feat⭐,fix🐞,docs📖,chore💄,style🎨,type🆎,test⛑️,refactor🐝,website🌍,revert🔙,clean💊,perf📈,ci💢,build⛽" | |
template: | | |
## Bugs | |
{{fix}} | |
## Feature | |
{{feat}} | |
## Improve | |
{{refactor,perf,clean}} | |
## Misc | |
{{chore,style,ci||🔶 Nothing change}} | |
## Unknown | |
{{__unknown__}} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
uses: gradle/[email protected] | |
with: | |
arguments: build | |
- name: Rename artifact to use tag as version | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
mv build/libs/*.jar build/libs/archivist-${{github.ref_name}}.jar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: artifact | |
with: | |
name: artifact | |
path: build/libs/*.jar | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
body: | | |
${{ steps.changelog.outputs.compareurl }} | |
${{ steps.changelog.outputs.changelog }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: build/libs/*.jar | |
- uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/libs/*.jar | |
asset_name: archivist-${{github.ref_name}}.jar | |
asset_content_type: application/java-archive | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ steps.create_release.outputs.id }} |