|
| 1 | +name: Pull Request |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - master |
| 7 | + - 'dependabot**' |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + name: Lint |
| 12 | + runs-on: ubuntu-24.04-arm |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v5 |
| 16 | + |
| 17 | + - name: Hadolint |
| 18 | + |
| 19 | + with: |
| 20 | + dockerfile: Dockerfile |
| 21 | + |
| 22 | + build-test: |
| 23 | + name: Push test |
| 24 | + if: ${{ !startsWith(github.ref, 'refs/heads/doc') && !startsWith(github.ref, 'refs/heads/test') }} |
| 25 | + runs-on: ubuntu-24.04-arm |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v5 |
| 29 | + |
| 30 | + - name: Extract branch name |
| 31 | + id: branch |
| 32 | + run: | |
| 33 | + if [ "${{ github.event_name }}" == "pull_request" ]; then |
| 34 | + BRANCH_NAME="${{ github.head_ref }}" |
| 35 | + else |
| 36 | + BRANCH_NAME="${GITHUB_REF#refs/heads/}" |
| 37 | + fi |
| 38 | + # Sanitize branch name for Docker tag (replace special chars with -) |
| 39 | + SANITIZED_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9._-]/-/g' | tr '[:upper:]' '[:lower:]') |
| 40 | + echo "name=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT |
| 41 | + echo "Branch name: $BRANCH_NAME -> Docker tag: test-$SANITIZED_BRANCH" |
| 42 | +
|
| 43 | + - name: Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v3 |
| 45 | + with: |
| 46 | + install: true |
| 47 | + |
| 48 | + - name: QEMU |
| 49 | + uses: docker/setup-qemu-action@v3 |
| 50 | + with: |
| 51 | + image: tonistiigi/binfmt:latest |
| 52 | + platforms: amd64,arm64 |
| 53 | + |
| 54 | + - name: Build and push test image |
| 55 | + env: |
| 56 | + DOCKER_BUILDKIT: 1 |
| 57 | + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} |
| 58 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + VERSION: ${{ steps.branch.outputs.name }} |
| 60 | + VERSION_PREFIX: test- |
| 61 | + TERM: xterm-256color |
| 62 | + run: make push |
| 63 | + |
| 64 | + pull-request: |
| 65 | + name: Pull Request |
| 66 | + runs-on: ubuntu-24.04-arm |
| 67 | + steps: |
| 68 | + - name: Checkout |
| 69 | + uses: actions/checkout@v5 |
| 70 | + with: |
| 71 | + fetch-depth: 0 |
| 72 | + |
| 73 | + - name: Template |
| 74 | + shell: bash |
| 75 | + run: | |
| 76 | + mkdir -p .tmp |
| 77 | + curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md |
| 78 | +
|
| 79 | + - name: Create Pull Request |
| 80 | + uses: devops-infra/[email protected] |
| 81 | + with: |
| 82 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + assignee: ${{ github.actor }} |
| 84 | + template: .tmp/PULL_REQUEST_TEMPLATE.md |
| 85 | + get_diff: true |
0 commit comments