Merge pull request #203 from sohosai/release/0.7.1 #71
Workflow file for this run
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
on: | |
push: | |
tags: ["*"] | |
name: Release | |
jobs: | |
push-image: | |
name: Push image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: sos-backend | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN_JSYS23 }}" | |
- name: Build the image | |
run: docker load < $(nix-build nix/image.nix --argstr tag latest --argstr name sos21-backend) | |
- name: Tag the image | |
run: docker tag sos21-backend:latest "ghcr.io/sohosai/sos21-backend:${GITHUB_REF#refs/tags/}" | |
- name: Tag the image (beta) | |
run: | | |
version=${GITHUB_REF#refs/tags/} | |
docker tag sos21-backend:latest "ghcr.io/sohosai/sos21-backend:${version%-beta*}-beta" | |
if: "${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta') }}" | |
- name: Tag the image (latest) | |
run: docker tag sos21-backend:latest "ghcr.io/sohosai/sos21-backend:latest" | |
if: "${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') }}" | |
- name: Login to the registry | |
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login ghcr.io -u '${{ github.actor }}' --password-stdin | |
- name: Push the image | |
run: docker push --all-tags "ghcr.io/sohosai/sos21-backend" | |
generate-api-server-document: | |
name: Generate documentation from OpenAPI schema | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
- run: nix-env -f ./nix/pkgs.nix -iA nodejs | |
- run: cd sos21-api-server/schema; npm install | |
- run: cd sos21-api-server/schema; npm run build:doc -- --output dist/api-server.html | |
- run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
id: get-tag | |
- uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./sos21-api-server/schema/dist | |
destination_dir: "${{ steps.get-tag.outputs.tag }}" | |
keep_files: true | |
- uses: peaceiris/actions-gh-pages@v3 | |
if: "${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') }}" | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./sos21-api-server/schema/dist | |
keep_files: true | |
generate-rustdoc: | |
name: Generate rustdoc documentation | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: sos-backend | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN_JSYS23 }}' | |
- run: nix-env -f ./nix/pkgs.nix -iA rustPlatform.rust.cargo | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: --no-deps --document-private-items | |
- run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
id: get-tag | |
- uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./target/doc | |
destination_dir: "${{ steps.get-tag.outputs.tag }}" | |
keep_files: true | |
- uses: peaceiris/actions-gh-pages@v3 | |
if: "${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta') }}" | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./target/doc | |
keep_files: true |