chore(build): use GitHub action to build and publish image #3
Workflow file for this run
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: Docker Image CI | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
pull_request: | |
branches: [ "main" ] | |
env: | |
DOCKERHUB_ORG: elpaasoci | |
OCI_IMAGE: concourse-fly-resource | |
jobs: | |
build_and_publish: | |
name: build and publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: publish git-branch-heads-resource standard image | |
uses: docker/[email protected] | |
with: | |
push: true | |
tags: | | |
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:latest | |
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.sha}} | |
ghcr.io/${{ github.repository }}:latest | |
ghcr.io/${{ github.repository }}:${{github.sha}} | |
- | |
name: publish git-branch-heads-resource tagged image | |
if: github.ref_type == 'tag' | |
uses: docker/[email protected] | |
with: | |
push: true | |
tags: | | |
${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}}:${{github.ref_name}} | |
ghcr.io/${{ github.repository }}:${{github.ref_name}} | |
- | |
name: Update repo description | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
repository: ${{env.DOCKERHUB_ORG}}/${{env.OCI_IMAGE}} | |
short-description: ${{ github.event.repository.description }} - Orange Cloudfoundry fork. |