Skip to content

Commit

Permalink
use nomad-deploy composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
RafDevX committed Jan 23, 2025
1 parent 7ba4f34 commit 371440b
Showing 1 changed file with 6 additions and 43 deletions.
49 changes: 6 additions & 43 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,16 @@ on:
branches: [ master ]
workflow_dispatch:

env:
NOMAD_VERSION: 1.7.7

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Git checkout
uses: actions/checkout@v4

- name: Set environment variables
run: |
cat >> "$GITHUB_ENV" <<EOF
latest=ghcr.io/${{ github.repository }}:latest
current=ghcr.io/${{ github.repository }}:$(git rev-parse --short ${{ github.sha }})
EOF
- name: Download Nomad
run: |
curl -LO https://releases.hashicorp.com/nomad/${{ env.NOMAD_VERSION }}/nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip
unzip -d /usr/local/bin nomad_${{ env.NOMAD_VERSION }}_linux_amd64.zip nomad
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
- name: Deploy to Nomad
uses: datasektionen/nomad-deploy@v1
with:
push: true
tags: ${{ env.latest }},${{ env.current }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
github-token: ${{ secrets.GITHUB_TOKEN }}
nomad-token: ${{ secrets.NOMAD_TOKEN }}
nomad-addr: ${{ vars.NOMAD_ADDR }}
build-vars: |
RAZZLE_TAITAN_URL=https://taitan.datasektionen.se
RAZZLE_CALYPSO_URL=https://calypso.datasektionen.se/api
- name: Deploy to nomad
env:
NOMAD_ADDR: ${{ vars.NOMAD_ADDR }}
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
run: |
nomad run -var=image_tag=${{ env.current }} job.nomad.hcl

0 comments on commit 371440b

Please sign in to comment.