Skip to content

Commit

Permalink
fix: push images
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinebigard committed Mar 30, 2023
1 parent a792f34 commit f6a8249
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ jobs:
restore-keys: |
${{ runner.os }}-
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_FG_TOKEN }}

- name: Run yarn Install
run: yarn install

Expand All @@ -34,3 +41,5 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.G_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
GHCR_USER: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.GH_FG_TOKEN }}
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ fileignoreconfig:
checksum: 937b3c6985c909437e9a4362eea76eccd3a946ead5bea27f24f9b0ced02df128
- filename: .github/workflows/publish.yml
checksum: cf87922f9cd1d8f4bb965920800187860609408c64406991a6dfad0ab79cc6aa
- filename: .github/workflows/release.yml
checksum: 96cdfb3f17eb6f7be3852f165c6587659570a814f879705348b7abaffc29742a
- filename: .infra/README.md
checksum: 46ff20cd40c93c0580c896707afadccc37486909997213c452393d8179d12a3d
- filename: .infra/ansible/roles/setup/files/app/.overrides/common/docker-compose.common.yml
Expand Down Expand Up @@ -33,6 +35,8 @@ fileignoreconfig:
checksum: 4ac0001fb9e12df75becb3eec2cc41431bc036b293cdcfee3b769daf8649e5e8
- filename: .infra/scripts/vault/renew-vault.sh
checksum: 86ee05100090183153d43671fd74bddf0552793dfe0f2a9a01c137d3cb248487
- filename: git-hooks/prepare-release.sh
checksum: 451afde847ac06703ffa04ea37b058d8522b60b94c891bf0979158dac5bc3610
- filename: server/.env.test
checksum: c0ef2f69099b6b85e1ee02f31ead22e9b7385bbb213d610fb953c0fc976709ac
scopeconfig:
Expand Down
34 changes: 30 additions & 4 deletions git-hooks/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@

next_version="${1}"

echo "${2}"
echo "$@"
echo $SLACK_WEBHOOK

cd ./ui
npm version ${next_version}
cd ../server
npm version ${next_version}
cd ../shared
npm version ${next_version}

cd ..


echo "Login sur le registry ..."
echo $GHCR_PASSWORD | docker login ghcr.io -u "$GHCR_USER" --password-stdin
echo "Logged!"

echo "Création des images docker (docker build)"

echo "Build ui:$next_version ..."
docker build . -f "ui/Dockerfile" --tag ghcr.io/mission-apprentissage/mna_bal_ui:"$next_version" \
--label "org.opencontainers.image.source=https://github.com/mission-apprentissage/bal" \
--label "org.opencontainers.image.description=Ui bal" \
--label "org.opencontainers.image.licenses=MIT"

echo "Building server:$next_version ..."
docker build . -f "server/Dockerfile" --tag ghcr.io/mission-apprentissage/mna_bal_server:"$next_version" \
--label "org.opencontainers.image.source=https://github.com/mission-apprentissage/bal" \
--label "org.opencontainers.image.description=Server bal" \
--label "org.opencontainers.image.licenses=MIT"

# L'enchainement de commande plante régulièrement => Le sleep 3 résoud en partie le problème
sleep 3
echo "Push des images locales sur le registry"
echo "Pushing ui:$next_version ..."
docker push ghcr.io/mission-apprentissage/mna_bal_ui:"$next_version"
sleep 3
echo "Pushing server:$next_version ..."
docker push ghcr.io/mission-apprentissage/mna_bal_server:"$next_version"
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const mainConfig = {
[
"@semantic-release/exec",
{
prepareCmd: `./git-hooks/prepare-release.sh \${nextRelease.version} ${process.env.SLACK_WEBHOOK}`,
prepareCmd: "./git-hooks/prepare-release.sh ${nextRelease.version}",
},
],
[
Expand Down

0 comments on commit f6a8249

Please sign in to comment.