refactor(configuration): Update server configuration file handling an… #22
This file contains hidden or 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: Docker GHCR | |
| permissions: | |
| contents: write | |
| packages: write | |
| pull-requests: write | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: vnyan-server-docker | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set image refs | |
| shell: bash | |
| run: | | |
| owner_lower="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')" | |
| echo "IMAGE_OWNER_LOWER=${owner_lower}" >> $GITHUB_ENV | |
| echo "IMAGE_REF=${REGISTRY}/${owner_lower}/${IMAGE_NAME}" >> $GITHUB_ENV | |
| # --- GHCR login --- | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| else | |
| VERSION=latest | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Build and push Docker image (multi-arch) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64 | |
| tags: | | |
| ${{ env.IMAGE_REF }}:${{ env.VERSION }} | |
| ${{ env.IMAGE_REF }}:latest | |
| build-args: | | |
| VNYAN_VERSION=${{ env.VERSION }} |