From 35883c2d83728d414520171e40e1ef671bd48090 Mon Sep 17 00:00:00 2001 From: Yuanlin Date: Sun, 8 Aug 2021 21:25:20 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20[ci]=20trying=20to=20add=20githu?= =?UTF-8?q?b=20action=20auto=20build=20and=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-release.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..4c79fa9 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,47 @@ +on: + push: + branches: + - main + +name: Upload Release Asset + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Set up Maven Central Repository + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + - name: Build project + run: mvn package + - name: Get Time + id: time + uses: nanzm/get-time-action@v1.1 + with: + timeZone: 8 + format: 'YYYY-MM-DD-HH-mm-ss' + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.time.outputs.time }} + release_name: Release ${{ steps.time.outputs.time }} + draft: false + prerelease: false + - name: Upload Release Asset + 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 }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./target/mcplugin-1.0-SNAPSHOT.jar + asset_name: mcplugin-1.0-SNAPSHOT.jar + asset_content_type: application/jar