Skip to content

Commit bec685e

Browse files
committed
deploy barn barroch
1 parent f8a8dd7 commit bec685e

File tree

3 files changed

+99
-15
lines changed

3 files changed

+99
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Create and publish a Docker image
2+
on:
3+
workflow_call:
4+
inputs:
5+
jelastic_env:
6+
description: "Jelastic environment name"
7+
required: true
8+
type: string
9+
image_name:
10+
description: "Name for image"
11+
required: false
12+
default: ${{ github.repository }}
13+
type: string
14+
secrets:
15+
jelastic_access_token:
16+
required: true
17+
shopify_api_key:
18+
required: true
19+
20+
jobs:
21+
build-and-push-image:
22+
runs-on: ubuntu-latest
23+
env:
24+
SHOPIFY_API_KEY: ${{ secrets.shopify_api_key_production_baroch }}
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
tags: |
41+
type=sha,prefix={{branch}}-
42+
43+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
44+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
45+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
46+
- name: Build and push Docker image
47+
id: push
48+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
49+
with:
50+
context: .
51+
push: true
52+
build-args: |
53+
SHOPIFY_API_KEY=${{ secrets.shopify_api_key_production_baroch }}
54+
tags: ghcr.io/${{ inputs.image_name }}:${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
57+
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
58+
# - name: Generate artifact attestation
59+
# uses: actions/attest-build-provenance@v1
60+
# with:
61+
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
62+
# subject-digest: ${{ steps.push.outputs.digest }}
63+
# push-to-registry: true
64+
- name: Redeploy containers
65+
run: |
66+
sudo apt-get install curl -y
67+
curl https://app.jpc.infomaniak.com/1.0/environment/control/rest/redeploycontainersbygroup?envName=${{inputs.jelastic_env}}\&session=${{secrets.jelastic_access_token}}\&tag=${{steps.meta.outputs.tags}}\&nodeGroup=cp
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
jobs:
8+
build-and-push-image:
9+
permissions:
10+
contents: read
11+
packages: write
12+
attestations: write
13+
id-token: write
14+
uses: ./.github/workflows/build-and-deploy-prod-barroch.yml
15+
with:
16+
jelastic_env: barnbarroch-producer
17+
secrets: inherit

.github/workflows/deploy-main.yml

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: Create and publish a Docker image
1+
# name: Create and publish a Docker image
22

3-
on:
4-
push:
5-
branches: ["main"]
3+
# on:
4+
# push:
5+
# branches: ["main"]
66

7-
jobs:
8-
build-and-push-image:
9-
permissions:
10-
contents: read
11-
packages: write
12-
attestations: write
13-
id-token: write
14-
uses: ./.github/workflows/build-and-deploy-prod.yml
15-
with:
16-
jelastic_env: fdc-producer
17-
secrets: inherit
7+
# jobs:
8+
# build-and-push-image:
9+
# permissions:
10+
# contents: read
11+
# packages: write
12+
# attestations: write
13+
# id-token: write
14+
# uses: ./.github/workflows/build-and-deploy-prod.yml
15+
# with:
16+
# jelastic_env: fdc-producer
17+
# secrets: inherit

0 commit comments

Comments
 (0)