v0.5.4 #59
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
tags: | |
- "*.*.*" | |
name: Build and Release | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.current_tag.outputs.tag }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: https://registry.npmjs.org | |
- name: Verify versions | |
run: node --version && npm --version && node -p process.versions.v8 | |
- name: Cache build context | |
id: cache-node | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: ${{ runner.os }}-${{ runner.arch }}-node | |
- name: Get current tag | |
id: current_tag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
with: | |
fallback: 0.0.0 | |
- name: Install dependencies | |
run: npm install --no-audit | |
- name: Run build | |
run: npm run build | |
- name: Archive output files | |
run: tar -zcvf ./release-${{ steps.current_tag.outputs.tag }}.tar.gz dist/ | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.current_tag.outputs.tag }} Release | |
path: ./release-${{ steps.current_tag.outputs.tag }}.tar.gz | |
retention-days: 30 | |
- name: Release new version | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.current_tag.outputs.tag }} | |
body: "⚠️ Changelog not yet provided." | |
files: ./release-${{ steps.current_tag.outputs.tag }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ship: | |
needs: build | |
environment: build-ship | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
env/nginx/ | |
Dockerfile | |
- name: Acquire Docker image metadata | |
id: metadata | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
proseim/prose-app-web | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=tag | |
type=raw,value=${{ needs.build.outputs.tag }} | |
type=raw,value=latest | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to the container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build.outputs.tag }} Release | |
- name: Extract build artifacts | |
run: tar -xzvf ./release-${{ needs.build.outputs.tag }}.tar.gz | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
push: true | |
deploy: | |
needs: [build, ship] | |
environment: app.prose.org | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Nomad | |
uses: hashicorp/setup-nomad@v1.0.0 | |
- name: Request deployment to Nomad | |
env: | |
NOMAD_ADDR: ${{ vars.NOMAD_ADDR }} | |
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }} | |
NOMAD_HTTP_AUTH: ${{ secrets.NOMAD_HTTP_AUTH }} | |
run: | | |
nomad var put -force nomad/jobs/prose-app-web IMAGE_TAG=${{ needs.build.outputs.tag }} |