Cargo update #921
This file contains hidden or 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: "Check" | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Install nix | |
| uses: cachix/install-nix-action@master | |
| with: | |
| github_access_token: '${{ secrets.GITHUB_TOKEN }}' | |
| - name: Setup cachix | |
| uses: cachix/cachix-action@master | |
| with: | |
| name: linyinfeng | |
| signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | |
| - name: Nix flake check | |
| run: nix flake check | |
| upload-docker-image: | |
| if: ${{ github.event_name == 'push' }} | |
| runs-on: ubuntu-latest | |
| needs: check | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| image_tag: ${{ steps.upload.outputs.image_tag }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Install nix | |
| uses: cachix/install-nix-action@master | |
| with: | |
| github_access_token: '${{ secrets.GITHUB_TOKEN }}' | |
| - name: Setup cachix | |
| uses: cachix/cachix-action@master | |
| with: | |
| name: linyinfeng | |
| signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | |
| - name: Upload docker image | |
| id: upload | |
| run: | | |
| image_archive=$(nix build .#dockerImage --no-link --print-out-paths) | |
| function push_to { | |
| echo "push to '$1'" | |
| skopeo copy \ | |
| --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \ | |
| "docker-archive:$image_archive" \ | |
| "$1" | |
| } | |
| tag=$(nix eval .#dockerImage.imageTag --raw) | |
| echo "image_tag=$tag" >> $GITHUB_OUTPUT | |
| push_to "docker://ghcr.io/linyinfeng/commit-notifier:$tag" | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| push_to "docker://ghcr.io/linyinfeng/commit-notifier:latest" | |
| fi |