Skip to content

disable announcements #40

disable announcements

disable announcements #40

name: Publish to Jamsocket
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: new.jamcr.io
IMAGE_NAME: ${{ secrets.JAMSOCKET_ACCOUNT }}/jupyter-notebook
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# this splits the JAMSOCKET_TOKEN on a period and takes the first portion as the docker registry user
- name: Set JAMCR_USER from token
env:
JAMSOCKET_TOKEN: ${{ secrets.JAMSOCKET_TOKEN }}
id: token_public
run: echo "JAMCR_USER=${JAMSOCKET_TOKEN%\.*}" >> $GITHUB_ENV
# this splits the JAMSOCKET_TOKEN on a period and takes the second portion as the docker registry pass
- name: Set JAMCR_PASS from token
env:
JAMSOCKET_TOKEN: ${{ secrets.JAMSOCKET_TOKEN }}
id: token_secret
run: echo "JAMCR_PASS=${JAMSOCKET_TOKEN#*\.}" >> $GITHUB_ENV
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.JAMCR_USER }}
password: ${{ env.JAMCR_PASS }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
type=raw,value=latest
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}