Skip to content

Documenatation update #3

Documenatation update

Documenatation update #3

Workflow file for this run

name: "Package xbridge_witnessd"
on:
push:
branches: ['main', 'release', 'develop', '*-rc*', '*-b*']
pull_request:
workflow_dispatch:
jobs:
package:
name: Build packages
runs-on: ubuntu-latest
container:
image: rippleci/xbwd-builder
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build packages
uses: ./.github/actions/package
- name: Save server
uses: actions/upload-artifact@v3
with:
name: xbwd
path: build/xbridge_witnessd
deploy_image:
runs-on: ubuntu-latest
name: Publish Docker images
needs: package
env:
# The repo on Docker Hub the image will get pushed to. GHCR will be set by ${{ github.repository_owner }}
DOCKERHUB_REPO: legleux
# The the "latest" image will be built from this branch
LATEST_BRANCH: main
IMAGE_NAME: xbwd
DH_CREDS: "${{ secrets.DOCKERHUB_USER }} ${{ secrets.DOCKERHUB_PW }}"
GH_CREDS: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: xbwd
- name: Set tags
id: tag_name
shell: bash
run: |
SHA=${GITHUB_SHA::7}
BASE_IMAGE_NAME=${IMAGE_NAME}:${SHA}
echo "BASE_IMAGE_NAME=${BASE_IMAGE_NAME}" >> $GITHUB_OUTPUT
BRANCH=${GITHUB_REF#refs/heads/}
DH_TAGS="${SHA} ${BRANCH}"
GH_TAGS="${SHA} ${BRANCH}"
DH_IMAGE_NAME=${DOCKERHUB_REPO}/${IMAGE_NAME}
echo "DH_IMAGE_NAME=${DH_IMAGE_NAME}" >> $GITHUB_OUTPUT
GH_IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}"
echo "GH_IMAGE_NAME=${GH_IMAGE_NAME}" >> $GITHUB_OUTPUT
if [[ $BRANCH == $LATEST_BRANCH ]]; then
echo "Tagging $BRANCH as 'latest'"
DH_TAGS+=" latest"
GH_TAGS+=" latest"
fi
echo "DH_TAGS=${DH_TAGS}" >> $GITHUB_OUTPUT
echo "GH_TAGS=${GH_TAGS}" >> $GITHUB_OUTPUT
- name: Build Docker image
shell: bash
run: |
IMAGE=${{ steps.tag_name.outputs.BASE_IMAGE_NAME }}
chmod +x xbridge_witnessd
docker build . -t ${IMAGE} --file .github/actions/image/Dockerfile
docker run --rm ${IMAGE} /opt/xbwd/bin/xbridge_witnessd --version
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: Push to dockerhub
shell: bash
run: |
for tag in ${{ steps.tag_name.outputs.DH_TAGS }}; do
echo "Tagging ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} to ${{ steps.tag_name.outputs.DH_IMAGE_NAME }}:${tag} for Docker Hub"
docker tag ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} ${{ steps.tag_name.outputs.DH_IMAGE_NAME }}:${tag}
echo "Pushing ${{ steps.tag_name.outputs.DH_IMAGE_NAME}}:${tag} to Docker Hub"
docker push ${{ steps.tag_name.outputs.DH_IMAGE_NAME}}:${tag}
done
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to ghcr
shell: bash
run: |
for tag in ${{ steps.tag_name.outputs.GH_TAGS }}; do
echo "Tagging ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} to ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} for GHCR"
docker tag ${{ steps.tag_name.outputs.BASE_IMAGE_NAME}} ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag}
echo "Pushing ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag} to GHCR"
docker push ${{ steps.tag_name.outputs.GH_IMAGE_NAME }}:${tag}
done