Skip to content

harden env parsing

harden env parsing #6

Workflow file for this run

name: Release
on:
workflow_dispatch:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-22.04
steps:
###################################################
#
# Prepare
#
###################################################
- name: (PREPARE) Set up QEMU
uses: docker/setup-qemu-action@v2
- name: (PREPARE) Checkout Repository
uses: actions/checkout@v3
- name: (PREPARE) Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: (PREPARE) Install Dependencies
run: |
rm -rf node_modules
npm ci
###################################################
#
# Build
#
###################################################
- name: (BUILD) Build Binaries
run: npm run build:binary:x64
- name: (BUILD) Package binary xz
run: npm run package:binary:xz
- name: (BUILD) Package binary tar gz
run: npm run package:binary:tar:gz
- name: (BUILD) Package binary zip
run: npm run package:binary:zip
- name: (BUILD) Package source xz
run: npm run package:source:xz
- name: (BUILD) Package source tar gz
run: npm run package:source:tar:gz
- name: (BUILD) Package source zip
run: npm run package:source:zip
- name: (BUILD) Package source standalone xz
run: npm run package:source:standalone:xz
- name: (BUILD) Package source standalone tar gz
run: npm run package:source:standalone:tar:gz
- name: (BUILD) Package source standalone zip
run: npm run package:source:standalone:zip
###################################################
#
# Docker
#
###################################################
- name: (DOCKER) Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: (DOCKER) Log in to the container registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: (DOCKER) Build Docker image
uses: docker/build-push-action@v5.0.0
with:
load: true
tags: ghcr.io/opentosca/opentosca-vintner-shop-demo:latest,ghcr.io/opentosca/opentosca-vintner-shop-demo:${{ github.sha }}
- name: (DOCKER) Push Docker image
uses: docker/build-push-action@v5.0.0
with:
push: true
tags: ghcr.io/opentosca/opentosca-vintner-shop-demo:latest
- name: (DOCKER) Save docker image as tar ball
run: docker save ghcr.io/opentosca/opentosca-vintner-shop-demo:${{ github.sha }} | gzip > dist/shop.docker.tar.gz
###################################################
#
# Release
#
###################################################
- name: (RELEASE) Delete Latest Release
run: gh release delete latest || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: (RELEASE) Delete Latest Tag
uses: actions/github-script@v3
with:
script: |
try {
await github.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/latest"
})
} catch (e) {
console.log("Did not delete tag:", e)
}
- name: (RELEASE) Create Latest Tag
uses: actions/github-script@v3
with:
script: |
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/latest",
sha: context.sha
})
- name: (RELEASE) Create Latest Release
run: gh release create latest -t "Latest Release" -n "This is the latest release of this project" ./dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}