Skip to content

Update gradle-release.yml #6

Update gradle-release.yml

Update gradle-release.yml #6

Workflow file for this run

name: Release
on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v3
- name: executable
run: chmod a+x ./gradlew
- name: setup jdk
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'corretto'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: apply version to properties and envs
run: |
export version=$(echo ${GITHUB_REF##*/} | sed 's/^v//')
echo "version=$version" > ./version.properties
echo "VERSION=$version" >> $GITHUB_ENV
- name: build
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: jar
uses: gradle/gradle-build-action@v2
with:
arguments: :api:jar
- name: path
run: |
ls -l
ls -l ./api
ls -l ./api/build/
ls -l ./api/build/libs
- name: release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body_path: ./api/build/libs/mfm-*.jar
draft: false
prerelease: false
- name: upload
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: ./api/build/libs/mfm-*.jar
- name: apply version to repository
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
git add ./version.properties
git commit -m "Apply version to repository $VERSION"
git push