|
| 1 | +name: docker-unsafe |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - next_release |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - next_release |
| 10 | + |
| 11 | +jobs: |
| 12 | + docker_dev_unsafe: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + timeout-minutes: 90 |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + if: > |
| 19 | + !contains(github.event.head_commit.message, 'PUSHPROD') && |
| 20 | + ( |
| 21 | + github.repository == 'jokob-sk/NetAlertX' || |
| 22 | + github.repository == 'netalertx/NetAlertX' |
| 23 | + ) |
| 24 | +
|
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Set up QEMU |
| 30 | + uses: docker/setup-qemu-action@v3 |
| 31 | + |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + |
| 35 | + # --- Generate timestamped dev version |
| 36 | + - name: Generate timestamp version |
| 37 | + id: timestamp |
| 38 | + run: | |
| 39 | + ts=$(date -u +'%Y%m%d-%H%M%S') |
| 40 | + echo "version=dev-${ts}" >> $GITHUB_OUTPUT |
| 41 | + echo "Generated version: dev-${ts}" |
| 42 | +
|
| 43 | + - name: Set up dynamic build ARGs |
| 44 | + id: getargs |
| 45 | + run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT |
| 46 | + |
| 47 | + - name: Get release version |
| 48 | + id: get_version |
| 49 | + run: echo "version=Dev" >> $GITHUB_OUTPUT |
| 50 | + |
| 51 | + # --- debug output |
| 52 | + - name: Debug version |
| 53 | + run: | |
| 54 | + echo "GITHUB_REF: $GITHUB_REF" |
| 55 | + echo "Version: '${{ steps.get_version.outputs.version }}'" |
| 56 | +
|
| 57 | + # --- Write the timestamped version to .VERSION file |
| 58 | + - name: Create .VERSION file |
| 59 | + run: echo "${{ steps.timestamp.outputs.version }}" > .VERSION |
| 60 | + |
| 61 | + - name: Docker meta |
| 62 | + id: meta |
| 63 | + uses: docker/metadata-action@v5 |
| 64 | + with: |
| 65 | + images: | |
| 66 | + ghcr.io/netalertx/netalertx-dev-unsafe |
| 67 | + jokobsk/netalertx-dev-unsafe |
| 68 | + tags: | |
| 69 | + type=raw,value=unsafe |
| 70 | + type=raw,value=${{ steps.timestamp.outputs.version }} |
| 71 | + type=ref,event=branch |
| 72 | + type=ref,event=pr |
| 73 | + type=sha |
| 74 | +
|
| 75 | + - name: Login GHCR (netalertx org) |
| 76 | + uses: docker/login-action@v3 |
| 77 | + with: |
| 78 | + registry: ghcr.io |
| 79 | + username: ${{ github.actor }} |
| 80 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + |
| 82 | + - name: Login GHCR (jokob-sk legacy) |
| 83 | + if: github.event_name != 'pull_request' |
| 84 | + uses: docker/login-action@v3 |
| 85 | + with: |
| 86 | + registry: ghcr.io |
| 87 | + username: jokob-sk |
| 88 | + password: ${{ secrets.GHCR_JOKOBSK_PAT }} |
| 89 | + |
| 90 | + - name: Log in to DockerHub |
| 91 | + if: github.event_name != 'pull_request' |
| 92 | + uses: docker/login-action@v3 |
| 93 | + with: |
| 94 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 95 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 96 | + |
| 97 | + - name: Build and push |
| 98 | + uses: docker/build-push-action@v6 |
| 99 | + with: |
| 100 | + context: . |
| 101 | + platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 |
| 102 | + push: ${{ github.event_name != 'pull_request' }} |
| 103 | + tags: ${{ steps.meta.outputs.tags }} |
| 104 | + labels: | |
| 105 | + org.opencontainers.image.title=NetAlertX Dev Unsafe |
| 106 | + org.opencontainers.image.description=EXPERIMENTAL BUILD – NOT SUPPORTED – DATA LOSS POSSIBLE |
| 107 | + org.opencontainers.image.version=${{ steps.timestamp.outputs.version }} |
| 108 | + netalertx.stability=unsafe |
| 109 | + netalertx.support=none |
| 110 | + netalertx.data_risk=high |
| 111 | + cache-from: type=gha |
| 112 | + cache-to: type=gha,mode=max |
0 commit comments