A game framework written with osu! in mind.
at master 66 lines 2.5 kB view raw
1# There is no manual way to call this out to run this on tags via UI. 2# See: https://github.community/t/workflow-dispatch-from-a-tag-in-actions-tab/130561 3on: workflow_dispatch 4name: Deploy - NativeLibs 5 6jobs: 7 check-if-tag: 8 name: Set Package Version 9 runs-on: ubuntu-latest 10 outputs: 11 version: ${{steps.deployment.outputs.version}} 12 steps: 13 - name: Checkout 14 run: | 15 REPOSITORY="https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git" 16 BRANCH="${GITHUB_REF/#refs\/heads\//}" 17 18 git version 19 git clone --no-checkout ${REPOSITORY} . 20 git config --local gc.auto 0 21 22 git -c protocol.version=2 fetch --no-tags --prune --progress --depth=2 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH} 23 git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH 24 25 26 - name: Set Variables 27 id: deployment 28 shell: bash 29 run: | 30 if [ $(git describe --exact-match --tags HEAD &> /dev/null; echo $?) == 0 ]; then 31 echo "::set-output name=VERSION::$(git describe --exact-match --tags HEAD)" 32 else 33 echo "fatal: no tag detected for HEAD. Workflow will now stop." 34 exit 128; 35 fi 36 37 deploy: 38 name: Deploy 39 runs-on: ubuntu-latest 40 needs: check-if-tag 41 steps: 42 - name: Checkout 43 uses: actions/checkout@v2 44 45 - name: Set Artifacts Directory 46 id: artifactsPath 47 run: echo "::set-output name=NUGET_ARTIFACTS::${{github.workspace}}/artifacts" 48 49 - name: Setup .NET 5.0.x 50 uses: actions/setup-dotnet@v1 51 with: 52 dotnet-version: "5.0.x" 53 54 - name: Build NativeLibs 55 run: dotnet pack -c Release osu.Framework.NativeLibs /p:Configuration=Release /p:Version=${{needs.check-if-tag.outputs.version}} /p:GenerateDocumentationFile=true -o ${{steps.artifactsPath.outputs.nuget_artifacts}} 56 57 - name: Upload Artifacts 58 uses: actions/upload-artifact@v2 59 with: 60 name: osu-framework-nativelibs 61 path: ${{steps.artifactsPath.outputs.nuget_artifacts}}/*.nupkg 62 63 - name: Deploy 64 run: | 65 dotnet nuget add source https://api.nuget.org/v3/index.json -n authed-nuget -u ${{secrets.NUGET_USER_NAME}} -p ${{secrets.NUGET_AUTH_TOKEN}} 66 dotnet nuget push ${{github.workspace}}/artifacts/*.nupkg --skip-duplicate --source authed-nuget