diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 02ac585..fceea14 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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" @@ -15,6 +16,8 @@ updates: directory: "/" schedule: interval: "daily" + commit-message: + prefix: "chore(ci): " open-pull-requests-limit: 10 assignees: - "tuxpeople" diff --git a/.github/workflows/pullrequests.yml b/.github/workflows/pullrequests.yml index c85034f..5633c47 100644 --- a/.github/workflows/pullrequests.yml +++ b/.github/workflows/pullrequests.yml @@ -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: @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 742a1d4..bcb4660 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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/checkout@v2.3.4 - 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/checkout@v2.3.4 - 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/setup-qemu-action@v1.2.0 - 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/login-action@v1.10.0 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/dockerhub-description@v2.4.3 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 }}