Skip to content

Commit

Permalink
changes to workflows, remove quay.io
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxpeople committed Sep 30, 2021
1 parent d490a7e commit 52758f7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 52 deletions.
9 changes: 6 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ version: 2
updates:

# Maintain dependencies for Docker
- package-ecosystem: docker
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
interval: "daily"
commit-message:
prefix: "feat: "
assignees:
- "tuxpeople"

Expand All @@ -15,6 +16,8 @@ updates:
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(ci): "
open-pull-requests-limit: 10
assignees:
- "tuxpeople"
7 changes: 5 additions & 2 deletions .github/workflows/pullrequests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: ci
name: "Build & Test"

env:
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64" # Build for which platforms

on:
pull_request:
Expand Down Expand Up @@ -35,5 +38,5 @@ jobs:
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64
platforms: ${{ env.PLATFORMS }}
push: false
76 changes: 29 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
name: ci
name: "Build & Release"

# This worflow needs those secrets:
#
# REGISTRY_TOKEN = Quay.io token
# DOCKERPASSWORD = Docker Hub token

on:
push:
branches: [master, main]
tags: 'v*.*.*'
schedule:
- cron: "0 13 * * 1"
- cron: '3 4 * * 1'
push:
branches:
- 'master'
- 'main'

env:
PLATFORMS: "linux/amd64,linux/arm/v7,linux/i386,linux/arm64" # Build for which platforms
IMAGENAME: "quay.io/tdeutsch/jdownloader-headless" # Name of the image
DEFAULT_TAG: "latest" # Which tag is beeing used if we are building for master/main branch
QUAY_USER: "tdeutsch" # Which user to use to login to quay.io
DOCKER_USER: "tdeutsch" # Which user to use to login to DockerHub
PLATFORMS: "linux/amd64,linux/arm/v7,linux/i386,linux/arm64" # Build for which platforms
DOCKER_USER: "tdeutsch" # Which user to use to login to DockerHub

#####
# To rebuild someone else's repo, do this:
Expand All @@ -33,41 +30,26 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/[email protected]
-
name: Generate Build-Args
id: build-args
run: |
# echo ::set-output name=build-arg1::"buildarg1"
# echo ::set-output name=build-arg2::"buildarg2"
-
name: Checkout
uses: actions/[email protected]
-
name: Prepare
id: prep
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
if [[ $VERSION =~ ^v([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
TAGS="${{ env.IMAGENAME }}:latest"
TAGS="${TAGS},${{ env.IMAGENAME }}:${MAJOR}"
TAGS="${TAGS},${{ env.IMAGENAME }}:${MAJOR}.${MINOR}"
TAGS="${TAGS},${{ env.IMAGENAME }}:${MAJOR}.${MINOR}.${PATCH}"
else
TAGS="${{ env.IMAGENAME }}:${VERSION}"
fi
elif [[ $GITHUB_REF == refs/heads/* ]]; then
TIMESTAMP=$(date +%Y%m%d%H%M%S)
TAGS="${{ env.IMAGENAME }}:${TIMESTAMP}"
TAGS="${TAGS},${{ env.IMAGENAME }}:${{ env.DEFAULT_TAG }}"
elif [[ $GITHUB_REF == refs/pull/* ]]; then
TAGS="${{ env.IMAGENAME }}:pr-${{ github.event.number }}"
fi
IMAGENAME=$(echo ${{ github.repository }} | sed 's/${{ github.repository_owner }}\/docker-//g')
IMAGEPREFIX="ghcr.io/${{ github.repository_owner }}"
IMAGE="${IMAGEPREFIX}/${IMAGENAME}"
TAGS="${IMAGE}:latest"
echo ::set-output name=tags::${TAGS}
echo ::set-output name=imagename::${IMAGENAME}
echo ::set-output name=version::${VERSION}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
-
name: Hadolint
Expand All @@ -79,15 +61,15 @@ jobs:
uses: docker/[email protected]
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
uses: docker/setup-buildx-action@v1
-
name: Login to Quay.io
name: Login to GHCR
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
uses: docker/[email protected]
with:
registry: quay.io
username: ${{ env.QUAY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
id: docker_build
Expand All @@ -102,10 +84,11 @@ jobs:
${{ steps.build-args.outputs.build-arg1 }}
${{ steps.build-args.outputs.build-arg2 }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.title=${{ steps.prep.outputs.imagename }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
Expand All @@ -115,15 +98,14 @@ jobs:
run: |
for i in $(echo ${{ steps.prep.outputs.tags }} | sed "s/,/ /g")
do
GHTAG=$(echo $i | sed "s/quay.io/docker.io/g" | sed "s/${{ env.QUAY_USER }}/${{ env.DOCKER_USER }}/g")
skopeo copy --all --src-creds=${{ env.QUAY_USER }}:${{ secrets.REGISTRY_TOKEN }} --dest-creds=${{ env.DOCKER_USER }}:${{ secrets.DOCKERPASSWORD }} docker://${i} docker://${GHTAG}
GHTAG=$(echo $i | sed "s/ghcr.io/docker.io/g" | sed "s/${{ github.repository_owner }}/${{ env.DOCKER_USER }}/g")
skopeo copy --all --src-creds=${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }} --dest-creds=${{ env.DOCKER_USER }}:${{ secrets.DOCKERPASSWORD }} docker://${i} docker://${GHTAG}
done
echo ::set-output name=shortname::$(echo ${{ env.IMAGENAME }} | sed "s/quay.io\///g")
-
name: Docker Hub Description
uses: peter-evans/[email protected]
with:
username: ${{ env.DOCKER_USER }}
password: ${{ secrets.DOCKERPASSWORD }}
repository: ${{ steps.copy_images.outputs.shortname }}

repository: "${{ env.DOCKER_USER }}/${{ steps.prep.outputs.imagename }}"
short-description: ${{ github.event.repository.description }}

0 comments on commit 52758f7

Please sign in to comment.