chore: configure version, mode, and build hash #21
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: CI/CD Serambi Kami (Staging Mode) | |
on: | |
push: | |
branches: ["staging"] | |
jobs: | |
build: | |
if: github.event_name == 'push' | |
name: Build Serambi Kami (Staging Mode) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Insecure Docker Repository | |
run: | | |
sudo truncate -s-2 /etc/docker/daemon.json | |
echo ", \"insecure-registries\": [\"${{ secrets.DOCKER_REGISTRY_URL }}\"]}" | sudo tee -a /etc/docker/daemon.json | |
sudo systemctl restart docker | |
- name: Docker Auth | |
run: | | |
echo "${{ secrets.DOCKER_REGISTRY_PASSWORD }}" | docker login ${{ secrets.DOCKER_REGISTRY_URL }} --username ${{ secrets.DOCKER_REGISTRY_USERNAME }} --password-stdin | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Extract version and short commit hash | |
run: | | |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build Docker Image | |
run: | | |
docker build \ | |
--build-arg BUILD_HASH=$SHORT_SHA \ | |
--build-arg SENTRY_ORG=${{ secrets.SENTRY_ORG }} \ | |
--build-arg SENTRY_PROJECT=${{ secrets.SENTRY_PROJECT }} \ | |
--build-arg SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \ | |
-f Dockerfile.staging \ | |
-t ${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_REGISTRY_USERNAME }}/serambi-kami:latest \ | |
. | |
- name: Push Docker Image | |
run: | | |
docker push ${{ secrets.DOCKER_REGISTRY_URL }}/${{ secrets.DOCKER_REGISTRY_USERNAME }}/serambi-kami:latest |