Skip to content

Commit

Permalink
v1-prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
xfhg committed Sep 11, 2024
1 parent ead33fb commit 181670c
Show file tree
Hide file tree
Showing 132 changed files with 23,594 additions and 12 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

name: Intercept Documentation Deploy

on:

push:
branches: [doc]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Copy lock file
run: cp docs/package-lock.json .
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies and Build it
run: |
cd docs
npm install
npm run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
84 changes: 84 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Intercept Image Release

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
push:
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Fetch Tags
run: |
git fetch --tags -f
TAG=$(git describe --tags --always)
VERSION=${TAG#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Update
run: sudo apt-get update -y

- name: Make all release artifacts
run: make build-all

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
run: |
PLATFORMS=(linux/amd64 linux/arm linux/arm64)
for platform in "${PLATFORMS[@]}"; do
os=$(echo $platform | cut -d'/' -f1)
arch=$(echo $platform | cut -d'/' -f2)
docker buildx build --platform $platform \
--build-arg BINARY=release/intercept-$os-$arch \
-t xfhg/intercept:${{ env.VERSION }}-$os-$arch \
-t xfhg/intercept:latest-$os-$arch \
-t ghcr.io/${{ github.repository }}:${{ env.VERSION }}-$os-$arch \
-t ghcr.io/${{ github.repository }}:latest-$os-$arch \
--push \
.
done
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Intercept Binary Pre-Release
name: Intercept Binary Release

on:
push:
Expand All @@ -20,6 +20,26 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Fetch Tags
run: |
git fetch --tags -f
git describe --abbrev=0
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://x.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Make all release artifacts
run: make build-all

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand All @@ -32,7 +52,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get_version.outputs.VERSION }}
body: >
Pre-Release for ${{ steps.get_version.outputs.VERSION }}
Release ${{ steps.get_version.outputs.VERSION }}
gzip: "false"
files: >
release/intercept-darwin-amd64
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/upx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Intercept xfhg/upx Image Release

on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
file: ./Dockerfile.upx
context: .
push: true
tags: xfhg/upx:latest
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ playground/intercept_*

playground/_*

# release/
release/

docs/
docs/.vitepress/dist/
docs/.vitepress/cache/

local/
6 changes: 6 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

tasks:
- init: K
command: make build


1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
intercept.cc
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:latest
WORKDIR /usr/local/bin
ARG BINARY
COPY ${BINARY} intercept
RUN chmod +x intercept && apk update && apk add --no-cache ripgrep ca-certificates && rm -rf /var/cache/apk/*
# ENTRYPOINT ["/usr/local/bin/intercept"]
# CMD ["--help"]


15 changes: 15 additions & 0 deletions Dockerfile.upx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:latest as curl
RUN apk add --no-cache curl
RUN curl -sSL $(curl -s https://api.github.com/repos/upx/upx/releases/latest \
| grep browser_download_url | grep amd64 | cut -d '"' -f 4) -o /upx.tar.xz

FROM busybox:latest as extractor
WORKDIR /
COPY --from=curl /upx.tar.xz /
RUN tar -xf upx.tar.xz \
&& cd upx-*-amd64_linux \
&& mv upx /bin/upx

FROM scratch
COPY --from=extractor /bin/upx /bin/upx
ENTRYPOINT ["/bin/upx"]
Loading

0 comments on commit 181670c

Please sign in to comment.