initial commit #2
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
name: "CI" | |
on: | |
pull_request: | |
push: | |
create: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
extra_nix_config: | | |
system-features = nixos-test benchmark big-parallel kvm | |
- uses: docker/setup-buildx-action@v2 | |
- run: nix build -L | |
- run: nix build -L '.#packages.x86_64-linux.wgithub-action-scan-image' | |
- run: nix flake check | |
publish: | |
needs: tests | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
extra_nix_config: | | |
system-features = nixos-test benchmark big-parallel kvm | |
- uses: docker/setup-buildx-action@v2 | |
- name: Extract tag name | |
shell: bash | |
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/})" | |
id: extract_tag | |
- run: nix build -L '.#packages.x86_64-linux.github-action-scan-image' | |
- run: docker load -i result | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker tag blackheaven/haskell-security-action ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_tag.outputs.tag }} | |
- run: docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.extract_tag.outputs.tag }} |