Skip to content

Commit

Permalink
Merge pull request #24 from groenator/release
Browse files Browse the repository at this point in the history
feat(iptvboss): publish IPTVBoss release v3.5.0.0
  • Loading branch information
groenator authored May 11, 2024
2 parents 320892d + c0804ac commit afd9e71
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 59 deletions.
129 changes: 72 additions & 57 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
name: Docker

# Define triggers
on:
release:
types:
- published
push:
branches:
- master
- '*'
# Publish semver tags as releases.
tags:
- 'v*.*.*'
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release
pull_request:
branches:
- master
- '*'
types:
- opened
- synchronize
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release

# Define environment variables
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
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
Expand All @@ -32,65 +64,48 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0
with:
cosign-release: 'v2.2.3'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@v3 # v3.0.0

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
uses: docker/login-action@v3 # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
username: groenator
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
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: Build and push Docker image for x86
id: build-and-push-x86
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Set release tag as environment variable
id: set-tag
run: |
echo "LATEST_TAG=$(cat release)" >> $GITHUB_ENV
echo $LATEST_TAG
- name: Build and push Docker image for ARM
id: build-and-push-arm
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
# Build and push Docker image for x86 (for pull requests)
- 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:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/arm64
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign the published Docker image for x86
if: ${{ github.event_name != 'pull_request' }}
env:
TAGS: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
DIGEST: ${{ steps.build-and-push-x86.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

- name: Sign the published Docker image for ARM
if: ${{ github.event_name != 'pull_request' }}
env:
TAGS: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm
DIGEST: ${{ steps.build-and-push-arm.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
build-args: |
LATEST_TAG=${{ env.LATEST_TAG }}
tags: ${{ steps.meta.outputs.tags }}
push: true
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM consol/debian-xfce-vnc:latest
# Set locale to avoid warnings
ENV LC_ALL=C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
ARG LATEST_TAG

# Switch to root temporarily to perform system updates
USER 0

# Set the working directory
Expand All @@ -31,7 +31,6 @@ RUN pip3 install requests

# Retrieve the latest release tag from GitHub
RUN CPU=$(dpkg-architecture -q DEB_HOST_ARCH_CPU) \
&& LATEST_TAG=$(wget -qO- https://api.github.com/repos/walrusone/iptvboss-release/releases/latest | jq -r .tag_name) \
&& wget https://github.com/walrusone/iptvboss-release/releases/download/${LATEST_TAG}/iptvboss_${LATEST_TAG#v}_${CPU}.deb \
&& apt install ./iptvboss_${LATEST_TAG#v}_${CPU}.deb && \
cp /usr/share/applications/io.github.walrusone.iptvboss-release.desktop /headless/Desktop/iptvboss-release.desktop && \
Expand Down
1 change: 1 addition & 0 deletions release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.5.0.0

0 comments on commit afd9e71

Please sign in to comment.