From ee18e8f19c2c40c360723904003ac36aff667c7a Mon Sep 17 00:00:00 2001 From: Sandy Rogers Date: Tue, 26 Sep 2023 17:42:41 +0100 Subject: [PATCH] Push built containers to registry (#38) * atlanteco notebook * fixing leafmap rendering * rename and clean notebook * adds workflow step to push built image to quay.io * fix actions var scope * switch to docker provided action * different format of github ref name * push using docker cli instead of build-push action * adds release workflow --------- Co-authored-by: Ekaterina Sakharova --- .github/workflows/preview.yaml | 1 - .github/workflows/release.yaml | 47 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 24 ++++++++++++++--- 3 files changed, 68 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index e49fa2d..81138a9 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -6,7 +6,6 @@ on: push: branches: - main - - 'static-docs' permissions: contents: read diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bd859e9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,47 @@ +name: Release + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Free up disk space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: false + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Dockerfile + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/Dockerfile + load: true + push: false + tags: quay.io/microbiome-informatics/emg-notebooks.dev:latest + + - name: Login to Quay.io + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: Push + run: | + docker tag quay.io/microbiome-informatics/emg-notebooks.dev:latest quay.io/microbiome-informatics/emg-notebooks.dev:${{ github.ref_name }} + docker push quay.io/microbiome-informatics/emg-notebooks.dev:${{ github.ref_name }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d786784..9c77a32 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,14 +41,15 @@ jobs: run: npm install - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build Dockerfile - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . file: ./docker/Dockerfile load: true + push: false tags: quay.io/microbiome-informatics/emg-notebooks.dev:latest - name: Run tests @@ -62,4 +63,21 @@ jobs: path: | tests/launching_jl.png tests/shiny_proxy_launched.png - tests/jl_launched.png \ No newline at end of file + tests/jl_launched.png + + - name: Login to Quay.io + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: Push + run: | + docker tag quay.io/microbiome-informatics/emg-notebooks.dev:latest quay.io/microbiome-informatics/emg-notebooks.dev:${{ github.ref_name }} + docker push quay.io/microbiome-informatics/emg-notebooks.dev:${{ github.ref_name }} + + - name: Push latest + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + run: | + docker push quay.io/microbiome-informatics/emg-notebooks.dev:latest