|
5 | 5 | branches: [ master ]
|
6 | 6 | workflow_dispatch:
|
7 | 7 |
|
8 |
| -env: |
9 |
| - NOMAD_VERSION: 1.7.7 |
10 |
| - |
11 | 8 | jobs:
|
12 | 9 | deploy:
|
13 | 10 | runs-on: ubuntu-latest
|
14 |
| - |
15 | 11 | steps:
|
16 |
| - - name: Git checkout |
17 |
| - uses: actions/checkout@v4 |
18 |
| - |
19 |
| - - name: Set environment variables |
20 |
| - run: | |
21 |
| - cat >> "$GITHUB_ENV" <<EOF |
22 |
| - latest=ghcr.io/${{ github.repository }}:latest |
23 |
| - current=ghcr.io/${{ github.repository }}:$(git rev-parse --short ${{ github.sha }}) |
24 |
| - EOF |
25 |
| -
|
26 |
| - - name: Download Nomad |
27 |
| - run: | |
28 |
| - curl -LO https://releases.hashicorp.com/nomad/${{ env.NOMAD_VERSION }}/nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip |
29 |
| - unzip -d /usr/local/bin nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip nomad |
30 |
| -
|
31 |
| - - name: Set up Docker Buildx |
32 |
| - uses: docker/setup-buildx-action@v3 |
33 |
| - |
34 |
| - - name: Log in to ghcr.io |
35 |
| - uses: docker/login-action@v3 |
36 |
| - with: |
37 |
| - registry: ghcr.io |
38 |
| - username: ${{ github.actor }} |
39 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
40 |
| - |
41 |
| - - name: Build and push |
42 |
| - uses: docker/build-push-action@v5 |
| 12 | + - name: Deploy to Nomad |
| 13 | + uses: datasektionen/nomad-deploy@v1 |
43 | 14 | with:
|
44 |
| - push: true |
45 |
| - tags: ${{ env.latest }},${{ env.current }} |
46 |
| - cache-from: type=gha |
47 |
| - cache-to: type=gha,mode=max |
48 |
| - |
49 |
| - - name: Deploy to nomad |
50 |
| - env: |
51 |
| - NOMAD_ADDR: ${{ vars.NOMAD_ADDR }} |
52 |
| - NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }} |
53 |
| - run: | |
54 |
| - nomad run -var=image_tag=${{ env.current }} job.nomad.hcl |
| 15 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 16 | + nomad-token: ${{ secrets.NOMAD_TOKEN }} |
| 17 | + nomad-addr: ${{ vars.NOMAD_ADDR }} |
0 commit comments