Skip to content

Update redturtle.prenotazioni 2.7.8 -> 2.7.9 #532

Update redturtle.prenotazioni 2.7.8 -> 2.7.9

Update redturtle.prenotazioni 2.7.8 -> 2.7.9 #532

Workflow file for this run

name: Update gh docker image and triggers
on:
# Triggers the workflow on releases
push:
branches:
- main
tags:
- '*'
pull_request:
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-image:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the image id
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV"
- name: Get the version PR
run: echo "VERSION=${{ github.head_ref }}" >> "$GITHUB_ENV"
if: github.event_name == 'pull_request'
- name: Get the version
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
if: github.event_name != 'pull_request'
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64
- name: Deploy to rancher # io-comune-test
if: github.ref == 'main'
uses: redturtle/[email protected]
with:
host: ${{ secrets.RANCHER_HOST }} # organization
api-username: ${{ secrets.RANCHER_API_USERNAME }} # organization
api-password: ${{ secrets.RANCHER_API_PASSWORD }} # organization
cluster-id: ${{ secrets.RANCHER_CLUSTER_ID }} # organization
project-id: ${{ secrets.RANCHER_PROJECT_ID }} # organization
namespace: ${{ secrets.RANCHER_NAMESPACE }}
workload: ${{ secrets.RANCHER_WORKLOAD }}
image: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
slack-hook-url: ${{ secrets.RANCHER_SLACK_HOOK_URL }}
- name: Trigger job
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
curl --fail --request POST \
--form token=${{ secrets.TOKEN }} \
--form ref=main \
--form "variables[GITHUB_TAG]=${{ env.VERSION }}" \
"https://gitlab.com/api/v4/projects/${{ secrets.PROJECT_ID }}/trigger/pipeline"
build-acceptance-image:
name: Build docker image for acceptance tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the image id
id: get_image_id
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }}-acceptance | tr '[A-Z]' '[a-z]')
echo "IMAGE_ID=$IMAGE_ID" >> "$GITHUB_ENV"
- name: Get the version PR
run: echo "VERSION=${{ github.head_ref }}" >> "$GITHUB_ENV"
if: github.event_name == 'pull_request'
- name: Get the version
run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
if: github.event_name != 'pull_request'
- name: Build and push container image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile.acceptance
push: true
tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }}
platforms: linux/amd64,linux/arm64