use correct syntax #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π Stage CI | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-push: | |
environment: stage | |
runs-on: ubuntu-latest | |
steps: | |
- name: π Checkout repository | |
uses: actions/checkout@v4 | |
- name: π Add CA certificate to Ubuntu root store and Docker config, then restart Docker | |
run: | | |
# Decode CA certificate to a temporary file | |
echo "${{ secrets.DOCKER_CA_CERT }}" | base64 -d | sudo tee /tmp/registry-ca.crt > /dev/null | |
# Move the certificate to the system root | |
sudo mv /tmp/registry-ca.crt /usr/local/share/ca-certificates/registry-ca.crt | |
# Update system certificates | |
sudo update-ca-certificates | |
# Restart Docker to apply the new CA certificate | |
sudo systemctl restart docker | |
echo "β CA certificate added to system root, Docker config, and Docker restarted." | |
- name: π³ Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-config-inline: | | |
[registry."${{ secrets.DOCKER_REGISTRY_URL }}"] | |
ca=["/usr/local/share/ca-certificates/registry-ca.crt"] | |
- name: π Log in to Private Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY_URL }} | |
username: ${{ secrets.DOCKER_REGISTRY_LOGIN }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
- name: π Build and Push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
tags: ${{ secrets.DOCKER_REGISTRY_URL }}/svaliava-water-site:latest | |
- name: β Upload completed | |
run: echo "π Image successfully uploaded to Private Registry!" |