Skip to content

upgrade dwn-sdk-js to v0.4.6 (#163) #129

upgrade dwn-sdk-js to v0.4.6 (#163)

upgrade dwn-sdk-js to v0.4.6 (#163) #129

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Create and publish a Docker image
on:
push:
branches: ['main']
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Create DWN Server docker image tag names
id: create_docker_image_tag_names
run: |
# extract the DWN Server version from the package.json
dwn_server_version=$(jq -r '.version' package.json)
# extract the DWN SDK version from the package.json
dwn_sdk_version=$(jq -r '.dependencies."@tbd54566975/dwn-sdk-js"' package.json)
# construct a image tag names using DWN server & DWN SDK versions
# (e.g. ghcr.io/tbd54566975/dwn-server:0.4.3)
# (e.g. ghcr.io/tbd54566975/dwn-server:dwn-sdk-0.4.4)
dwn_server_version_tag_name=${{ env.REGISTRY }}/${IMAGE_NAME,,}:$dwn_server_version
dwn_sdk_version_tag_name=${{ env.REGISTRY }}/${IMAGE_NAME,,}:dwn-sdk-$dwn_sdk_version
# write the image tag names to the step output for use later/below
echo "dwn_server_version_tag_name=$dwn_server_version_tag_name" >> $GITHUB_OUTPUT
echo "dwn_sdk_version_tag_name=$dwn_sdk_version_tag_name" >> $GITHUB_OUTPUT
env:
IMAGE_NAME: ${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.create_docker_image_tag_names.outputs.dwn_server_version_tag_name }}
${{ steps.create_docker_image_tag_names.outputs.dwn_sdk_version_tag_name }}
labels: ${{ steps.meta.outputs.labels }}