|
9 | 9 | pull_request: |
10 | 10 | branches: [ "main" ] |
11 | 11 |
|
| 12 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 13 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 14 | +concurrency: |
| 15 | + group: "pages" |
| 16 | + cancel-in-progress: false |
12 | 17 |
|
13 | | -jobs: |
| 18 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + pages: write # to deploy to Pages |
| 22 | + id-token: write # to verify the deployment originates from an appropriate source |
14 | 23 |
|
| 24 | +jobs: |
| 25 | + # Build job |
15 | 26 | build: |
16 | 27 | runs-on: ubuntu-latest |
17 | 28 | steps: |
18 | 29 | - uses: actions/checkout@v4 |
19 | 30 | with: |
20 | 31 | fetch-depth: 0 # Ensures full history, including tags |
21 | | - |
22 | 32 | - name: Set up Go |
23 | 33 | uses: actions/setup-go@v4 |
24 | 34 | with: |
25 | 35 | go-version: '1.24.1' |
26 | | - |
| 36 | + - name: Setup Pages |
| 37 | + uses: actions/configure-pages@v5 |
27 | 38 | - name: Build |
28 | 39 | run: | |
29 | 40 | go mod tidy # Ensures all required dependencies are installed |
| 41 | + echo "All required dependencies are installed" |
| 42 | + echo "Building undervolt-go..." |
30 | 43 | go build -ldflags="-X 'main.version=$(git describe --tags)'" -o undervolt-go main.go # When building your application, pass the version from git tags using ldflags. |
| 44 | + echo "Build complete!" |
| 45 | + echo "Working on making the compiled binary available..." |
31 | 46 | mkdir public |
32 | 47 | cp -r ./undervolt-go ./public/ # Copy the binary to the public directory |
33 | 48 | cp -r ./install/ ./public/ # Copy the scripts in the install directory to the public directory |
34 | | -
|
| 49 | + echo "Ready to deploy!" |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-pages-artifact@v3 |
| 52 | + with: |
| 53 | + # Upload entire repository |
| 54 | + path: './public' |
35 | 55 | #- name: Test |
36 | 56 | # run: go test -v ./... |
37 | 57 |
|
38 | 58 | # Deploy job |
39 | 59 | deploy: |
40 | 60 | # Add a dependency to the build job |
41 | 61 | needs: build |
42 | | - |
43 | | - # Grant GITHUB_TOKEN the permissions required to make a Pages deployment |
44 | | - permissions: |
45 | | - contents: read |
46 | | - pages: write # to deploy to Pages |
47 | | - id-token: write # to verify the deployment originates from an appropriate source |
48 | | - |
49 | 62 | # Deploy to the github-pages environment |
50 | 63 | environment: |
51 | 64 | name: github-pages |
52 | 65 | url: ${{ steps.deployment.outputs.page_url }} |
53 | | - |
54 | 66 | # Specify runner + deployment step |
55 | 67 | runs-on: ubuntu-latest |
56 | 68 | steps: |
57 | | - - name: Checkout |
58 | | - uses: actions/checkout@v4 |
59 | | - - name: Setup Pages |
60 | | - uses: actions/configure-pages@v5 |
61 | | - - name: Upload artifact |
62 | | - uses: actions/upload-pages-artifact@v3 |
63 | | - with: |
64 | | - # Upload entire repository |
65 | | - path: './public' |
66 | 69 | - name: Deploy to GitHub Pages |
67 | 70 | id: deployment |
68 | 71 | uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action |
0 commit comments