Skip to content

Update swarm.yml

Update swarm.yml #148

Workflow file for this run

name: buildx
on:
push:
branches:
- 'master'
- 'development'
- 'staging'
jobs:
docker:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: Set environment specific variables
uses: jnus/[email protected]
with:
scope: ${{ github.ref_name }}
configFile: '.github/workflows/variables.json'
secrets: '${{ toJson(secrets.github_token) }}'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup docker context for buildx
id: buildx-context
run: docker context create builders || docker context use builders
- name: Extract repository name
id: extract_repo_name
run: |
repo_url=${{ github.repository }}
repo_name=$(basename $repo_url)
echo "REPO_NAME=${repo_name}" >> $GITHUB_ENV
echo "REPO_NAME=${repo_name}"
- name: set lower case owner name
run: |
echo "REPO_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ env.REPO_NAME }}'
- name: copy ca
run: |
sudo mkdir -p /etc/docker/certs.d/${{ secrets.REGISTRY_URL }}
echo "${{ secrets.REGISTRY_CA }}" | sudo tee /etc/docker/certs.d/${{ secrets.REGISTRY_URL }}/ca.crt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
endpoint: builders
config-inline: |
[registry."${{ secrets.REGISTRY_URL }}"]
http = false
insecure = true
ca=["/etc/docker/certs.d/${{ secrets.REGISTRY_URL }}/ca.crt"]
- uses: bilberrry-infra/docker-build-args-action@master
id: action
with:
includeVars: ${{ toJson(env) }}
includeSecrets: ${{ toJson(secrets) }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
platforms: |
linux/amd64
build-args: ${{ steps.action.outputs.args }}
tags: ${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:${{ github.sha }},${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:${{ github.ref_name }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:buildcache
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ env.REPO_LC }}:buildcache,mode=max
notify-servers:
needs: docker
uses: fairdatasociety/ci_utils/.github/workflows/webhook.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
wh_secret: ${{ secrets.WEBHOOK_SECRET }}
wh_url_d: ${{ secrets.WEBHOOK_URL_DEVELOPMENT }}
wh_url_m: ${{ secrets.WEBHOOK_URL_MASTER }}
with:
branch: ${{ github.ref_name }}