Skip to content

feat(iptvboss): publish a new release #174

feat(iptvboss): publish a new release

feat(iptvboss): publish a new release #174

Workflow file for this run

name: Docker
on:
release:
types:
- published
push:
branches:
- master
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release
pull_request:
types:
- opened
- synchronize
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release
# Define environment variables
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
codeql:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: github/codeql-action/init@v3
with:
languages: python
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
build-and-publish:
if: |
github.repository == '${{ github.repository }}' &&
(
github.event_name == 'push' ||
github.event_name == 'release' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
)
needs: [codeql]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
images: |
ghcr.io/groenator/iptvboss-docker
tags: |
type=ref,event=pr
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Set release tag as environment variable
id: set-tag
run: |
echo "LATEST_TAG=$(cat release)" >> $GITHUB_ENV
echo $LATEST_TAG
# Build and push Docker image for x86 (for pull requests)
- name: Build and push Docker image for x86 (PR)
id: build-and-push-x86-pr
if: ${{ github.event_name == 'pull_request' }}
uses: docker/[email protected]
with:
context: .
build-args: |
LATEST_TAG=${{ env.LATEST_TAG }}
push: true
platforms: linux/amd64
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}-PR-${{ github.event.number }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Short commit
id: shortcommit
run: echo "::set-output name=value::$(git rev-parse --short HEAD)"
- name: Build and push final image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le
labels: ${{ steps.meta.outputs.labels }}
build-args: |
LATEST_TAG=${{ env.LATEST_TAG }}
tags: ${{ steps.meta.outputs.tags }}
push: true