name: CI-Release on: push: branches: - main jobs: clang-format: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: clang-format run: | docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src build-binary: runs-on: ubuntu-22.04 needs: clang-format steps: - uses: actions/checkout@v3 - name: create version.h run: | git_hash=$(git rev-parse --short "$GITHUB_SHA") cat < ./src/version.h #pragma once #define VERSION_EXTRA " (nightly-$git_hash)" EOF - name: build binary run: | docker build . -t builder docker run --rm -v ${PWD}:/project builder make - uses: actions/upload-artifact@master with: name: binary path: "*.wps" deploy-binary: needs: build-binary runs-on: ubuntu-22.04 steps: - name: Get environment variables id: get_repository_name run: | echo REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") >> $GITHUB_ENV echo DATETIME=$(echo $(date '+%Y%m%d-%H%M%S')) >> $GITHUB_ENV - uses: actions/download-artifact@master with: name: binary - name: zip artifact run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip *.wps - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }} release_name: Nightly-${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }} draft: false prerelease: true body: | Not a stable release: ${{ github.event.head_commit.message }} - 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: ./${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip asset_name: ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip asset_content_type: application/zip