Skip to content

Commit

Permalink
release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andyslack committed Nov 29, 2024
1 parent 1aa3cc3 commit 29dbb1b
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
105 changes: 105 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#
# GitHub Actions workflow.
#
# Releases the package to npm when a push into main is detected.
# * Checkout the code
# * Install Node.js
# * Install dependencies
# * Pull the latest changes
# * Bump version number
# * Pull the latest changes
# * Generate Docker meta
# * Build and push image
#

name: 'Release Package: Llana Portal'

on:
push:
branches:
- main
workflow_dispatch:

jobs:

release:
name: 'Release Package: CLI'
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '#skip-release') }}
permissions:
contents: write
steps:

- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CI_CD_RELEASE }}

- name: 'Install Node.js'
uses: actions/setup-node@v4
with:
node-version: 18.18.2

- name: 'Install dependencies'
run: npm install

- run: git pull --force

- name: 'Version Bump'
id: version
if: ${{ !contains(github.event.head_commit.message, '#skip-version-bump') }}
uses: phips28/gh-action-bump-version@master
env:
GITHUB_TOKEN: ${{ secrets.GH_CI_CD_RELEASE }}
with:
major-wording: 'MAJOR'
minor-wording: 'feature,feat'
patch-wording: 'patch,fixes,fix,misc,docs,refactor' # Providing patch-wording will override commits
commit-message: 'CI: Bump Version to {{version}} [skip ci]'
tag-prefix: 'v'

- run: git pull --force #Ensure we have the latest package version before pushing to NPM / Docker

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
juicyllama/llana-portal
# ghcr.io/username/app
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern=v{{version}},value=${{ steps.version.outputs.newTag }}
type=semver,pattern=v{{major}}.{{minor}},value=${{ steps.version.outputs.newTag }}
type=semver,pattern=v{{major}},value=${{ steps.version.outputs.newTag }}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: juicyllama
password: ${{ secrets.DOCKERHUB_TOKEN }}

#Checkout again to get latest package.json after bump and before we deploy
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_CI_CD_RELEASE }}

- name: Build and push image
uses: docker/build-push-action@v6
if: ${{ !contains(github.event.head_commit.message, '#skip-docker-publish') }}
with:
file: ./docker/images/base/Dockerfile
sbom: true
provenance: mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 29dbb1b

Please sign in to comment.