Skip to content

Commit

Permalink
fix: Fork docker release workflow (twilio#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuj Badhwar committed Sep 23, 2021
1 parent 8cfac65 commit c669c06
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 31 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Hub Release
on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Fetch tag
id: get-tag
run: |
git fetch --tags
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: twilio/twilio-cli
tags: type=semver,pattern={{version}}, value= ${{ steps.get-tag.outputs.TAG_NAME }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
- name: Image digest
run: |
echo ${{ steps.docker_build.outputs.digest }}
41 changes: 10 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,47 +74,26 @@ jobs:
with:
is_append_body: true
body: ${{ github.event.inputs.change-log }}
deploy-docker:
oclif-release:
runs-on: ubuntu-latest
needs: [ release ]

steps:
- name: Check Out Repo
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Docker meta
uses: docker/metadata-action@v3
with:
images: twilio/twilio-cli
tags: type=semver,pattern={{version}}, value= ${{ needs.release.outputs.tag-name }}
- name: Build and push
- name: Invoke Oclif workflow
if: ${{needs.release.outputs.tag-name != ''}}
id: docker_build
uses: docker/build-push-action@v2
uses: benc-uk/workflow-dispatch@v1
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
- name: Image digest
run: |
echo ${{ steps.docker_build.outputs.digest }}
oclif-release:
workflow: Oclif Release
repo: twilio/twilio-cli
token: ${{ secrets.REPO_ACCESS_TOKEN }}
inputs: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
docker-release:
runs-on: ubuntu-latest
needs: [ release ]
steps:
- name: Invoke CLI workflow with changelog and version-type
- name: Invoke Docker workflow
if: ${{needs.release.outputs.tag-name != ''}}
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Oclif Release
workflow: Docker Hub Release
repo: twilio/twilio-cli
token: ${{ secrets.REPO_ACCESS_TOKEN }}
inputs: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.tag-name}}", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'

0 comments on commit c669c06

Please sign in to comment.