Skip to content

Commit

Permalink
Add new steps to publish a containerized CyberChef to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
AshCorr committed Jan 30, 2024
1 parent da09e51 commit 3057105
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jobs:
run: |
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
47 changes: 46 additions & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_NAME: ${{ github.repository }}

jobs:
main:
runs-on: ubuntu-latest
Expand All @@ -16,10 +22,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Install
run: |
npm install
npm ci
npm run setheapsize
- name: Lint
Expand All @@ -40,6 +50,31 @@ jobs:
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
- name: Image Metadata
if: success()
id: image-metadata
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
- name: Production Image Build
if: success()
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
containerfiles: ./Containerfile
platforms: linux/arm64, linux/amd64
oci: true
extra-args: |
--ulimit nofile=4096:4096
- name: Upload Release Assets
if: success()
id: upload-release-assets
Expand All @@ -57,3 +92,13 @@ jobs:
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}

- name: Publish to GHCR
if: success()
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
3 changes: 3 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/static-web-server/static-web-server:2.25-alpine

COPY ./build/prod /public

0 comments on commit 3057105

Please sign in to comment.