diff --git a/.forgejo/workflows/deploy-frontend-learner.yaml b/.forgejo/workflows/deploy-frontend-learner.yaml index c402709b..4b76bb06 100644 --- a/.forgejo/workflows/deploy-frontend-learner.yaml +++ b/.forgejo/workflows/deploy-frontend-learner.yaml @@ -9,6 +9,11 @@ on: - 'Frontend-Learner/**' workflow_dispatch: +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + jobs: build: name: Build Frontend Learner Docker Image @@ -21,27 +26,26 @@ jobs: uses: docker/setup-buildx-action@v3 with: config-inline: | - [registry."${{ vars.DOCKER_REGISTRY }}"] + [registry."${{ env.REGISTRY }}"] http = true insecure = true - name: Login to Docker Registry uses: docker/login-action@v3 with: - registry: ${{ vars.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - insecure: true + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_REGISTRY }}/elearning-frontend-learner + images: ${{ env.REGISTRY }}/elearning-frontend-learner tags: | type=ref,event=branch type=sha,prefix= - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }} - name: Build and push Docker image uses: docker/build-push-action@v5 @@ -53,13 +57,12 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - insecure: true deploy: name: Deploy Frontend Learner to Server runs-on: ubuntu-latest needs: build - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' + if: github.ref == 'refs/heads/dev' steps: - name: Remote Deploy uses: appleboy/ssh-action@v1.2.1 diff --git a/.forgejo/workflows/deploy-frontend-management.yaml b/.forgejo/workflows/deploy-frontend-management.yaml index 4e3077fc..56ded2f0 100644 --- a/.forgejo/workflows/deploy-frontend-management.yaml +++ b/.forgejo/workflows/deploy-frontend-management.yaml @@ -9,6 +9,11 @@ on: - 'frontend_management/**' workflow_dispatch: +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + jobs: build: name: Build Frontend Management Docker Image @@ -21,27 +26,26 @@ jobs: uses: docker/setup-buildx-action@v3 with: config-inline: | - [registry."${{ vars.DOCKER_REGISTRY }}"] + [registry."${{ env.REGISTRY }}"] http = true insecure = true - name: Login to Docker Registry uses: docker/login-action@v3 with: - registry: ${{ vars.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - insecure: true + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ vars.DOCKER_REGISTRY }}/elearning-frontend-management + images: ${{ env.REGISTRY }}/elearning-frontend-management tags: | type=ref,event=branch type=sha,prefix= - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/dev' }} - name: Build and push Docker image uses: docker/build-push-action@v5 @@ -53,7 +57,6 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - insecure: true deploy: name: Deploy Frontend Management to Server