Merge commit 'ddba48f1f6e903e5e1f3bd8a62eeff2f16660581' into dev #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- dev | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch tags | |
run: git fetch --tags --force | |
- name: Metadata | |
run: echo "IS_RELEASE=${{ startsWith(github.ref, 'refs/tags/') }}" >> $GITHUB_ENV | |
- name: Environment | |
run: | | |
echo "VERSION=$(python build/print_version.py ${{ github.run_number }} ${{ env.IS_RELEASE }} false)" >> $GITHUB_ENV | |
echo "PYPI_VERSION=$(python build/print_version.py ${{ github.run_number }} ${{ env.IS_RELEASE }} pypi)" >> $GITHUB_ENV | |
echo "$(python build/print_solution.py)" >> $GITHUB_ENV | |
- name: Extract annotation tag | |
if: ${{ env.IS_RELEASE == 'true' }} | |
run: python build/create_tag_body.py | |
- name: Set up dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9.0.x" | |
- name: Install | |
run: | | |
dotnet workload install --temp-dir tmp wasm-tools | |
- name: Build | |
run: | | |
dotnet publish -c Release -o app /p:GeneratePackage=true src/GitHubPages/GitHubPages.csproj | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: | | |
artifacts/*.txt | |
artifacts/package/ | |
- name: Prepare GitHub Pages | |
run: | | |
touch app/wwwroot/.nojekyll | |
if: github.ref == 'refs/heads/main' | |
- name: Deploy GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: app/wwwroot | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
is_release: ${{ env.IS_RELEASE }} | |
version: ${{ env.VERSION }} | |
publish_dev: | |
needs: build | |
name: Publish (dev) | |
runs-on: ubuntu-latest | |
if: ${{ needs.build.outputs.is_release != 'true' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: Nuget package (MyGet) | |
run: dotnet nuget push 'artifacts/package/release/*.nupkg' --api-key ${MYGET_API_KEY} --source https://www.myget.org/F/apollo3zehn-dev/api/v3/index.json | |
env: | |
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }} | |
publish_release: | |
needs: build | |
name: Publish (release) | |
runs-on: ubuntu-latest | |
if: ${{ needs.build.outputs.is_release == 'true' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
path: artifacts | |
- name: GitHub Release Artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: artifacts/tag_body.txt | |
- name: Nuget package (Nuget) | |
run: dotnet nuget push 'artifacts/package/release/*.nupkg' --api-key ${NUGET_API_KEY} --source https://api.nuget.org/v3/index.json | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |