commit
b1c87ecc2c
3 changed files with 55 additions and 20 deletions
21
.github/workflows/docker_build_push.yml
vendored
21
.github/workflows/docker_build_push.yml
vendored
|
|
@ -1,11 +1,12 @@
|
||||||
name: Build and publish docker
|
name: Build and publish docker, and trigger release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "develop"
|
- "develop"
|
||||||
- "main"
|
pull_request:
|
||||||
tags:
|
types: [closed]
|
||||||
- "*.*.*"
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GHCR: ghcr.io
|
GHCR: ghcr.io
|
||||||
|
|
@ -15,6 +16,7 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push:
|
build_and_push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'push' }} || ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -167,3 +169,14 @@ jobs:
|
||||||
cache-to: type=gha,mode=max,scope=rpxy-latest-${{ matrix.target }}
|
cache-to: type=gha,mode=max,scope=rpxy-latest-${{ matrix.target }}
|
||||||
platforms: ${{ matrix.platforms }}
|
platforms: ${{ matrix.platforms }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
dispatch_release_event:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref == 'develop' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.merged == true }}
|
||||||
|
needs: build_and_push
|
||||||
|
steps:
|
||||||
|
- name: Repository dispatch for release
|
||||||
|
uses: peter-evans/repository-dispatch@v2
|
||||||
|
with:
|
||||||
|
event-type: release-event
|
||||||
|
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "pull_request": { "title": "${{ github.event.pull_request.title }}", "body": "${{ github.event.pull_request.body }}", "number": "${{ github.event.pull_request.number }}", "head": "${{ github.event.pull_request.head.ref }}", "base": "${{ github.event.pull_request.base.ref}}"}}'
|
||||||
|
|
|
||||||
49
.github/workflows/release.yml
vendored
49
.github/workflows/release.yml
vendored
|
|
@ -5,11 +5,17 @@ on:
|
||||||
- "Build and publish docker"
|
- "Build and publish docker"
|
||||||
types:
|
types:
|
||||||
- "completed"
|
- "completed"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
repository_dispatch:
|
||||||
|
types:
|
||||||
|
- release-event
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
on-success:
|
on-success:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }} || ${{ github.event_name == 'repositry_dispatch' }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -70,47 +76,58 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: "echo 'The relese triggering workflows passed'"
|
- run: "echo 'The relese triggering workflows passed'"
|
||||||
|
|
||||||
- name: "set env"
|
- name: "set env"
|
||||||
|
id: "set-env"
|
||||||
run: |
|
run: |
|
||||||
if [ ${{ matrix.platform }} = "linux/amd64" ];then PLATFORM_MAP="x86_64";else PLATFORM_MAP="aarch64";fi
|
if [ ${{ matrix.platform }} == 'linux/amd64' ]; then PLATFORM_MAP="x86_64"; else PLATFORM_MAP="aarch64"; fi
|
||||||
if [ ${{ github.ref_name == 'develop' }} ];then BUILD_NAME="rpxy-nightly";else BUILD_NAME="rpxy";fi
|
if [ ${{ github.ref_name }} == 'develop' ]; then BUILD_NAME="-nightly"; else BUILD_NAME=""; fi
|
||||||
echo "PLATFORM_MAP=${PLATFORM_MAP}" >> $GITHUB_ENV
|
if [ ${{ github.ref_name }} == 'develop' ]; then BUILD_IMG="nightly"; else BUILD_IMG="latest"; fi
|
||||||
echo "TARGET_NAME=${BUILD_NAME}-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_ENV
|
echo "build_img=${BUILD_IMG}" >> $GITHUB_OUTPUT
|
||||||
|
echo "target_name=rpxy${BUILD_NAME}-${PLATFORM_MAP}-unknown-linux-${{ matrix.target }}${{ matrix.build-feature }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: "docker pull and extract binary from docker image"
|
- name: "docker pull and extract binary from docker image"
|
||||||
id: "extract-binary"
|
id: "extract-binary"
|
||||||
run: |
|
run: |
|
||||||
CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:nightly${{ matrix.tags-suffix }}`
|
CONTAINER_ID=`docker create --platform=${{ matrix.platform }} ghcr.io/junkurihara/rust-rpxy:${{ steps.set-env.outputs.build_img }}${{ matrix.tags-suffix }}`
|
||||||
docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/${TARGET_NAME}
|
docker cp ${CONTAINER_ID}:/rpxy/bin/rpxy /tmp/${{ steps.set-env.outputs.target_name }}
|
||||||
cd /tmp
|
|
||||||
echo "artifact=${TARGET_NAME}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: "upload artifacts"
|
- name: "upload artifacts"
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.extract-binary.outputs.artifact }}
|
name: ${{ steps.set-env.outputs.target_name }}
|
||||||
path: "/tmp/${{ steps.extract-binary.outputs.artifact }}"
|
path: "/tmp/${{ steps.set-env.outputs.target_name }}"
|
||||||
|
|
||||||
on-failure:
|
on-failure:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'failure' }}
|
||||||
steps:
|
steps:
|
||||||
- run: echo 'The release triggering workflows failed'
|
- run: echo 'The release triggering workflows failed'
|
||||||
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: ${{ github.event_name == 'repository_dispatch' }}
|
||||||
needs: on-success
|
needs: on-success
|
||||||
steps:
|
steps:
|
||||||
|
- name: check pull_request title
|
||||||
|
uses: kaisugi/action-regex-match@v1.0.0
|
||||||
|
id: regex-match
|
||||||
|
with:
|
||||||
|
text: ${{ github.event.client_payload.pull_request.title }}
|
||||||
|
regex: "^(\\d+\\.\\d+\\.\\d+)$"
|
||||||
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
|
if: ${{ steps.regex-match.outputs.match != '' }}
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: download artifacts
|
- name: download artifacts
|
||||||
|
if: ${{ steps.regex-match.outputs.match != ''}}
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/rpxy
|
path: /tmp/rpxy
|
||||||
|
|
||||||
- name: make tar.gz of assets
|
- name: make tar.gz of assets
|
||||||
|
if: ${{ steps.regex-match.outputs.match != ''}}
|
||||||
run: |
|
run: |
|
||||||
mkdir /tmp/assets
|
mkdir /tmp/assets
|
||||||
cd /tmp/rpxy
|
cd /tmp/rpxy
|
||||||
|
|
@ -118,11 +135,13 @@ jobs:
|
||||||
ls -lha /tmp/assets
|
ls -lha /tmp/assets
|
||||||
|
|
||||||
- name: release
|
- name: release
|
||||||
|
if: ${{ steps.regex-match.outputs.match != ''}}
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
with:
|
with:
|
||||||
files: /tmp/assets/*.tar.gz
|
files: /tmp/assets/*.tar.gz
|
||||||
tag_name: ${{ github.ref }}
|
name: ${{ github.event.client_payload.pull_request.title }}
|
||||||
|
tag_name: ${{ github.event.client_payload.pull_request.title }}
|
||||||
|
body: ${{ github.event.client_payload.pull_request.body }}
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: false
|
prerelease: false
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
|
||||||
5
.github/workflows/shift_left.yml
vendored
5
.github/workflows/shift_left.yml
vendored
|
|
@ -1,6 +1,9 @@
|
||||||
name: ShiftLeft Scan
|
name: ShiftLeft Scan
|
||||||
|
|
||||||
on: push
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
types: [synchronize, opened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Scan-Build:
|
Scan-Build:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue