Skip to content

Remove environment URL from environment #22

Remove environment URL from environment

Remove environment URL from environment #22

Workflow file for this run

name: Build
on:
push:
branches:
- 'main'
permissions:
contents: write
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Get Latest Version
id: latest
uses: gregziegan/[email protected]
- name: Calculate Next Version
id: calculate
uses: paulhatch/[email protected]
with:
version_format: "${major}.${minor}.${patch}"
- name: Determine Next Version
if: ${{ contains(steps.latest.outputs.name, '.') }}
id: version
uses: haya14busa/action-cond@v1
with:
cond: ${{ contains(steps.latest.outputs.name, '.') }}
if_true: ${{ steps.calculate.outputs.version }}
if_false: '0.0.1'
- name: Remove Leading "v" from Latest Version
if: ${{ contains(steps.latest.outputs.name, '.') }}
id: latest_clean
run: |
export version=$(echo ${{ steps.latest.outputs.name }} | sed 's/^v//')
echo ::set-output name=name::$version
- name: Update Version in Files (1)
if: ${{ contains(steps.latest.outputs.name, '.') }}
uses: datamonsters/replace-action@v2
with:
files: 'journal.go'
replacements: '${{ steps.latest_clean.outputs.name }}=${{ steps.version.outputs.value }}'
- name: Update Version in Files (2)
if: ${{ contains(steps.latest.outputs.name, '.') }}
uses: datamonsters/replace-action@v2
with:
files: 'web/app/package.json'
replacements: '${{ steps.latest_clean.outputs.name }}=${{ steps.version.outputs.value }}'
- name: File Save Delay
uses: jakejarvis/wait-action@master
with:
time: '2s'
- name: Commit Version Changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[skip ci] Update version to v${{ steps.version.outputs.value }}"
- name: Docker Login
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
- name: Build and Push Docker Image
run: |
docker build -t ghcr.io/jamiefdhurst/journal:latest .
docker tag ghcr.io/jamiefdhurst/journal:latest ghcr.io/jamiefdhurst/journal:v${{ steps.version.outputs.value }}
docker push ghcr.io/jamiefdhurst/journal:latest
docker push ghcr.io/jamiefdhurst/journal:v${{ steps.version.outputs.value }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
cache-dependency-path: go.sum
- name: Build Binary
run: |
sudo apt-get install -y build-essential libsqlite3-dev
go mod download
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -v -o journal-bin_linux_x64-v${{ steps.version.outputs.value }} .
cp journal-bin_linux_x64-v${{ steps.version.outputs.value }} bootstrap
zip -r journal-lambda_al2023-v${{ steps.version.outputs.value }}.zip bootstrap web -x web/app/\*
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
draft: false
makeLatest: true
tag: v${{ steps.version.outputs.value }}
name: v${{ steps.version.outputs.value }}
artifacts: "journal-bin_linux_x64-v${{ steps.version.outputs.value }},journal-lambda_al2023-v${{ steps.version.outputs.value }}.zip"