Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and publish Docker Hub image for amd64 and arm64 #304

Merged
merged 6 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .github/workflows/npm-publish.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Publish NPM package and Docker image
name: Release

on:
push:
pull_request:

jobs:
# Run tests using node, publish a package when tagged
# https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

publish-npm:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
if: startsWith(github.ref, 'refs/tags/')
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

publish-docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

# Setup docker to build for multiple platforms (requires qemu).
# See:
# https://github.com/docker/build-push-action/tree/v2.3.0#usage
# https://github.com/docker/build-push-action/blob/v2.3.0/docs/advanced/multi-platform.md

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# https://github.com/docker/login-action/tree/v1.8.0#docker-hub
- name: Login to Docker Hub
uses: docker/login-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# https://github.com/manics/action-major-minor-tag-calculator-test
manics marked this conversation as resolved.
Show resolved Hide resolved
# If this is a tagged build this will return additional parent tags.
# E.g. 1.2.3 is expanded to Docker tags
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest] unless
# this is a backported tag in which case the newer tags aren't updated.
# For branches this will return the branch name.
# If GITHUB_TOKEN isn't available (e.g. in PRs) returns no tags [].
- name: Get list of tags
id: gettags
# TODO: Move to org?
uses: manics/action-major-minor-tag-calculator@main
manics marked this conversation as resolved.
Show resolved Hide resolved
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
prefix: "jupyterhub/configurable-http-proxy:"

- name: Display tags
run: echo "Docker tags ${{ steps.gettags.outputs.tags }}"

- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
push: ${{ startsWith(github.ref, 'refs/tags/') }}
# tags parameter must be a string input so convert `gettags` JSON
# array into a comma separated list of tags
tags: ${{ join(fromJson(steps.gettags.outputs.tags)) }}