forked from jaymoulin/docker-jdownloader
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to workflows, remove quay.io
- Loading branch information
Showing
3 changed files
with
40 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 }} | ||
|
@@ -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 }} |