From a0014315c09c286972706374d3f7ebe91b46ae12 Mon Sep 17 00:00:00 2001 From: Mani Arasteh Date: Sat, 1 Jun 2024 19:25:19 +0330 Subject: [PATCH] Update pages.yml --- .github/workflows/pages.yml | 51 +++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index ffd4d3e..88eca76 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,17 +1,48 @@ name: Go on Pages -on: [push] + +on: + push: + branches: + - main + workflow_dispatch: jobs: build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v5 + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + # Change your go version as needed + go-version: 1.17 + + - name: Build + run: go build -v ./... + + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v2 + with: + name: go-app + path: | + . + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 with: - go-version: '1.21.x' - - name: Install dependencies - run: go get . - - name: Build - run: go build -v main.go + name: go-app + path: . + + - name: 'Deploy to Azure Web App' + - name: Deploy GitHub Pages site + uses: actions/deploy-pages@v4.0.5 + id: deploy-to-pages