Skip to content

Commit ff91723

Browse files
committed
ci: enable Docker support in GitHub Actions workflow
1 parent 36b3f98 commit ff91723

1 file changed

Lines changed: 12 additions & 30 deletions

File tree

.github/workflows/check-bioc.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ env:
3939
run_pkgdown: 'false'
4040
has_RUnit: 'false'
4141
cache-version: 'cache-v1'
42-
run_docker: 'false'
42+
run_docker: 'true'
4343

4444
jobs:
4545
build-check:
@@ -292,50 +292,32 @@ jobs:
292292
path: check
293293

294294

295-
## Code adapted from
296-
## https://github.com/waldronlab/cBioPortalData/blob/e0440a4445f0cc731e426363a76faa22ee5e0f9d/.github/workflows/devel_check_dock.yml#L65-L92
297-
docker-build-and-push:
295+
docker-build-and-push:
298296
runs-on: ubuntu-latest
299297
needs: build-check
298+
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
300299
steps:
301300
- name: Checkout Repository
302-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
303301
uses: actions/checkout@v3
304302

305-
- name: Register repo name
306-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
307-
id: reg_repo_name
303+
- name: Set repository name as environment variable
308304
run: |
309-
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
310-
311-
- name: Set up QEMU
312-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
313-
uses: docker/setup-qemu-action@v2
305+
echo CONT_IMG_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
314306
315307
- name: Set up Docker Buildx
316-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
317308
uses: docker/setup-buildx-action@v2
318309

319310
- name: Login to Docker Hub
320-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel'"
321311
uses: docker/login-action@v2
322312
with:
323-
username: ${{ secrets.DOCKERHUB_USERNAME }}
324-
password: ${{ secrets.DOCKERHUB_TOKEN }}
325-
## Note that DOCKERHUB_TOKEN is really a token for your dockerhub
326-
## account, not your actual dockerhub account password. You can get it
327-
## from https://hub.docker.com/settings/security.
328-
## Check https://github.com/docker/build-push-action/tree/v4.0.0
329-
## for more details.
330-
## Alternatively, try checking
331-
## https://seandavi.github.io/BuildABiocWorkshop/articles/HOWTO_BUILD_WORKSHOP.html.
313+
username: ${{ secrets.DOCKERHUB_USERNAME }}
314+
password: ${{ secrets.DOCKERHUB_TOKEN }}
332315

333316
- name: Build and Push Docker
334-
if: "!contains(github.event.head_commit.message, '/nodocker') && env.run_docker == 'true' && github.ref == 'refs/heads/devel' && success()"
335317
uses: docker/build-push-action@v4
336318
with:
337-
context: .
338-
push: true
339-
tags: >
340-
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest,
341-
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel
319+
context: .
320+
push: true
321+
tags: |
322+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:latest
323+
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.CONT_IMG_NAME }}:devel

0 commit comments

Comments
 (0)