Publish Docker images #2186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker images | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v*.*.* | |
schedule: | |
# Push nightly version at the end of every day | |
- cron: '0 0 * * *' | |
jobs: | |
docker: | |
name: Publish Docker images | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
node-version: [ 18.x ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build app | |
run: npm run build --if-present | |
- name: Build Docker image | |
run: docker build -t $OWNER/$IMAGE_NAME:local . | |
- name: Smoke test image | |
run: .ci_scripts/smoke_test.sh | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get version string from git tag name | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Print version string | |
run: echo ${{ steps.get_version.outputs.VERSION }} | |
- name: Push streamr/platform:dev | |
run: .ci_scripts/deploy_docker.sh dev | |
if: github.ref == 'refs/heads/master' && github.event_name != 'schedule' | |
- name: Push streamr/platform:nightly | |
run: .ci_scripts/deploy_docker.sh nightly | |
if: github.event_name == 'schedule' | |
- name: Push streamr/platform:latest | |
run: .ci_scripts/deploy_docker.sh production latest | |
if: github.ref == 'refs/heads/master' && github.event_name != 'schedule' | |
- name: Push streamr/platform:tag | |
run: .ci_scripts/deploy_docker.sh production ${{ steps.get_version.outputs.VERSION }} | |
if: startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' | |
env: | |
OWNER: streamr | |
IMAGE_NAME: platform |