show current head commit sha #27
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-build | |
on: | |
push: | |
branches: [ main, cd-setup ] | |
jobs: | |
docker-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- | |
name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Get latest tag | |
id: latest_tag | |
uses: DavidSpek/[email protected] | |
with: | |
img: 'ghcr.io/pluralsh/marketing-proxy' | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/pluralsh/marketing-proxy | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{raw}},value=${{ steps.latest_tag.outputs.new_patch }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
update-service: | |
needs: [docker-build] | |
runs-on: plrl-github-actions-runner | |
env: | |
PLURAL_CONSOLE_TOKEN: ${{ secrets.PLURAL_CONSOLE_TOKEN }} | |
PLURAL_CONSOLE_URL: ${{ secrets.PLURAL_CONSOLE_URL }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: installing plural | |
uses: pluralsh/[email protected] | |
- name: current sha | |
run: git rev-parse --short HEAD | |
- name: Update service | |
run: plural cd services update @mgmt/marketing --conf tag=sha-$(git rev-parse --short HEAD) |