Build and push resourcely-cli Docker image #23
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: Build and push resourcely-cli Docker image | |
on: | |
# push: | |
# branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
sha: | |
description: 'SHA or branch to deploy' | |
required: true | |
type: string | |
default: 'main' | |
tag: | |
description: 'Docker image tag (default is: latest)' | |
required: true | |
default: 'latest' | |
type: choice | |
options: | |
- latest | |
- dev | |
env: | |
IMAGE_NAME_CLI: ghcr.io/resourcely-inc/resourcely-cli:${{ inputs.tag }} | |
permissions: write-all | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
# Build and push resourcely-cli | |
- name: Checkout resourcely-cli code | |
uses: actions/checkout@v2 | |
with: | |
token: ${{ secrets.GH_ACCESS_TOKEN }} | |
repository: Resourcely-Inc/resourcely-cli | |
ref: ${{ inputs.sha }} | |
path: resourcely-cli | |
- name: Build resourcely-cli Docker image | |
run: | | |
docker build -t $IMAGE_NAME_CLI --build-arg="GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}" resourcely-cli | |
docker images # for debugging purposes | |
# Login and push resourcely-cli image | |
- name: Login to Github Container Registry | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push resourcely-cli Docker Image to Github Container Registry | |
run: docker push $IMAGE_NAME_CLI | |