Skip to content

tig welder: risk assessment #63

tig welder: risk assessment

tig welder: risk assessment #63

Workflow file for this run

name: Build
on:
push:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-rebuild:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docker-rebuild:
- '.github/workflows/**'
- 'generator/**'
- name: Log in to the Container registry
if: steps.filter.outputs.docker-rebuild == 'true'
uses: docker/login-action@v3.4.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
if: steps.filter.outputs.docker-rebuild == 'true'
id: meta
uses: docker/metadata-action@v5.7.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push
if: steps.filter.outputs.docker-rebuild == 'true'
uses: docker/build-push-action@v6
with:
context: "generator"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build:
runs-on: ubuntu-latest
needs: docker-rebuild
steps:
- uses: actions/checkout@v2
with:
path: hacklab-training
fetch-depth: 0
- name: Check if this branch has its own docker image
id: check_image
run: |
IMAGE_NAME="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
if docker pull $IMAGE_NAME; then
echo "Image exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Image does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build
run: |
docker run --rm -v $(pwd)/hacklab-training:/material -v $(pwd)/out:/out ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.check_image.exists == 'true' && github.ref_name || 'main' }} /material /out
sudo find out -type f -not -iname '*.pdf' -not -iname '*.html' -delete
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: out/
deploy:
needs: build
if: github.ref_name == github.event.repository.default_branch
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: "pages"
cancel-in-progress: false
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4