diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8f04a334 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Upload Release Asset + +on: + push: + tags: + - "v*" + +jobs: + main: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Java 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Build project + run: | + ./gradlew :projector-server:distZip + cd projector-server/build/distributions + find . -maxdepth 1 -type f -name projector-server-*.zip -exec mv {} projector-server.zip \; + - 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: false + prerelease: false + - name: Tag name # Inspired from https://github.community/t/how-to-get-just-the-tag-name/16241/11 + id: tag_name + run: echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} + - 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 }} + asset_path: projector-server/build/distributions/projector-server.zip + asset_name: projector-server-${{ steps.tag_name.outputs.SOURCE_TAG }}.zip + asset_content_type: application/zip