Skip to content

Commit c86cfe1

Browse files
committed
use nomad-deploy composite action
1 parent c3d3306 commit c86cfe1

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,13 @@ on:
55
branches: [ master ]
66
workflow_dispatch:
77

8-
env:
9-
NOMAD_VERSION: 1.7.7
10-
118
jobs:
129
deploy:
1310
runs-on: ubuntu-latest
14-
1511
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
4314
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

Comments
 (0)