From a00453e1510e6d00d7f109080b37352647a3a83e Mon Sep 17 00:00:00 2001 From: Perflyst Date: Thu, 21 Jan 2021 23:51:54 +0100 Subject: [PATCH 1/5] Build latest only on master, add commit sha tag Close #1688 --- .github/workflows/container-release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index b21123d2..3d61928f 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -4,6 +4,8 @@ on: push: branches: - "master" + pull_request: + branches: "*" jobs: release: @@ -27,7 +29,8 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} - - name: Build and push + - name: Build and push latest tag + if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v2 with: context: . @@ -35,5 +38,13 @@ jobs: push: true tags: quay.io/invidious/invidious:latest + - name: Build and push commit sha tag + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile + push: true + tags: quay.io/invidious/invidious:${{ github.sha }} + - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }} From 5ce0b1c18ee3ea722f2f1b1919509bf16c6ba1f6 Mon Sep 17 00:00:00 2001 From: Perflyst Date: Thu, 21 Jan 2021 23:54:31 +0100 Subject: [PATCH 2/5] Remove image digest output Does not work with two images at the same time --- .github/workflows/container-release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index 3d61928f..c8b2e56a 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -45,6 +45,3 @@ jobs: file: docker/Dockerfile push: true tags: quay.io/invidious/invidious:${{ github.sha }} - - - name: Image digest - run: echo ${{ steps.docker_build.outputs.digest }} From 380b64071eb79ad92ab5d608c1b0b69ffca5d7d6 Mon Sep 17 00:00:00 2001 From: Perflyst Date: Fri, 22 Jan 2021 00:03:09 +0100 Subject: [PATCH 3/5] Expire sha images after 6 weeks --- .github/workflows/container-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index c8b2e56a..b1a04f26 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -43,5 +43,6 @@ jobs: with: context: . file: docker/Dockerfile + labels: quay.expires-after=6w push: true tags: quay.io/invidious/invidious:${{ github.sha }} From 40a257982164c70cb12d421f835220abd41ea3c9 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 22 Jan 2021 09:20:17 +0530 Subject: [PATCH 4/5] different steps depending on event. --- .github/workflows/container-release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index b1a04f26..1859f082 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -9,7 +9,6 @@ on: jobs: release: - runs-on: ubuntu-latest steps: @@ -29,16 +28,18 @@ jobs: username: ${{ secrets.QUAY_USERNAME }} password: ${{ secrets.QUAY_PASSWORD }} - - name: Build and push latest tag + - name: Build and push for Push Event if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v2 with: context: . file: docker/Dockerfile + labels: quay.expires-after=12w push: true - tags: quay.io/invidious/invidious:latest + tags: quay.io/invidious/invidious:${{ github.sha }},quay.io/invidious/invidious:latest - - name: Build and push commit sha tag + - name: Build and push for Pull Request + if: github.ref != 'refs/heads/master' uses: docker/build-push-action@v2 with: context: . From c86e9dfc8a4f2dddc511f08f19fdeba97ab11143 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 22 Jan 2021 16:54:49 +0530 Subject: [PATCH 5/5] build image daily at 0:00 GMT --- .github/workflows/container-release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml index 1859f082..137308d0 100644 --- a/.github/workflows/container-release.yml +++ b/.github/workflows/container-release.yml @@ -6,6 +6,8 @@ on: - "master" pull_request: branches: "*" + schedule: + - cron: 0 0 * * * jobs: release: