Trigger action (#28)
* Add cron-triggered build * Add build triggered on file changes in the "config" folder * Add schedule to the cron workflow * Fix end line * Fix space * Remove REPO_NAME env * Add client and server repository dispatch type * Fix paths * Fix the space * Delete space * Return space * Return space * Replace space * Replace space
This commit is contained in:
parent
b7553b701a
commit
192dc275f8
32
.github/workflows/config-build.yml
vendored
Normal file
32
.github/workflows/config-build.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
name: 4testing multiarch-config-build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'hotfix/v*'
|
||||||
|
- 'release/v*'
|
||||||
|
- 'develop'
|
||||||
|
paths:
|
||||||
|
- 'config/**'
|
||||||
|
- 'install/docker/Dockerfile.app'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
select-branches:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out the code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Dispatch Action
|
||||||
|
run: |
|
||||||
|
echo "${GITHUB_REF_NAME}"
|
||||||
|
|
||||||
|
curl \
|
||||||
|
-X POST \
|
||||||
|
-u "${{ secrets.USERNAME}}:${{secrets.TOKEN}}" \
|
||||||
|
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/dispatches" \
|
||||||
|
-H "Accept: application/vnd.github.everest-preview+json" \
|
||||||
|
--data '{"event_type": "config-trigger-action", "client_payload": { "branches": ["'"${GITHUB_REF_NAME}"'"]}}'
|
66
.github/workflows/cron-build.yml
vendored
66
.github/workflows/cron-build.yml
vendored
@ -1,13 +1,8 @@
|
|||||||
name: 4testing multiarch-build
|
name: 4testing multiarch-cron-build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 20 * * *'
|
- cron: '0 20 * * *'
|
||||||
env:
|
|
||||||
DOCKER_PATH: "/install/docker"
|
|
||||||
REPO: "onlyoffice"
|
|
||||||
DOCKER_IMAGE_PREFIX: "4testing-docspace"
|
|
||||||
DOCKERFILE: "Dockerfile.app"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -17,13 +12,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out the code
|
- name: Check out the code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: List Branches
|
- name: List Branches
|
||||||
id: list-branches
|
id: list-branches
|
||||||
run: |
|
run: |
|
||||||
all_branches=$(git branch -a --format="%(refname:short)"|sed -e "s/^origin\///")
|
all_branches=$(git ls-remote -hq | sed -n 's/^[0-9a-f]\{40\}\s\+refs\/heads\//''/p')
|
||||||
matching_branches=""
|
matching_branches=""
|
||||||
|
|
||||||
for branch in $all_branches; do
|
for branch in $all_branches; do
|
||||||
@ -34,51 +27,14 @@ jobs:
|
|||||||
|
|
||||||
matching_branches=${matching_branches#,}
|
matching_branches=${matching_branches#,}
|
||||||
echo "json_output=[${matching_branches}]" >> $GITHUB_OUTPUT
|
echo "json_output=[${matching_branches}]" >> $GITHUB_OUTPUT
|
||||||
outputs:
|
|
||||||
selected-branches: ${{ steps.list-branches.outputs.json_output }}
|
|
||||||
|
|
||||||
|
- name: Dispatch Action
|
||||||
build:
|
|
||||||
needs: select-branches
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform: [linux/amd64]
|
|
||||||
branch: ${{ fromJson(needs.select-branches.outputs.selected-branches) }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ matrix.branch }}
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Free Disk Space
|
|
||||||
run: |
|
run: |
|
||||||
sudo rm -rf /usr/local/lib/android /opt/ghc
|
echo "${{ steps.list-branches.outputs.json_output }}"
|
||||||
sudo docker image prune --all --force
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
curl \
|
||||||
uses: docker/login-action@v2
|
-X POST \
|
||||||
with:
|
-u "${{ secrets.USERNAME}}:${{secrets.TOKEN}}" \
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
"https://api.github.com/repos/ONLYOFFICE/DocSpace-buildtools/dispatches" \
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
-H "Accept: application/vnd.github.everest-preview+json" \
|
||||||
|
--data '{"event_type": "cron-trigger-action", "client_payload": { "branches": ${{ steps.list-branches.outputs.json_output }}}}'
|
||||||
- name: Build 4testing
|
|
||||||
run: |
|
|
||||||
cd .${DOCKER_PATH}
|
|
||||||
if [ "${{ matrix.branch }}" = "develop" ]; then
|
|
||||||
DOCKER_TAG="develop.${{ github.run_number }}"
|
|
||||||
else
|
|
||||||
DOCKER_TAG=$(echo "${{ matrix.branch }}" | sed '/^release\b\|^hotfix\b\|^feature\b/s/release.*\/\|hotfix.*\/\|feature.*\///; s/-git-action$//; s/^v//').${{github.run_number}}
|
|
||||||
fi
|
|
||||||
export DOCKER_TAG
|
|
||||||
|
|
||||||
docker buildx bake -f build.yml \
|
|
||||||
--set *.args.GIT_BRANCH=${{ matrix.branch }} \
|
|
||||||
--set *.platform=linux/amd64 \
|
|
||||||
--push
|
|
||||||
shell: bash
|
|
||||||
|
61
.github/workflows/main-build.yml
vendored
Normal file
61
.github/workflows/main-build.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: 4testing multiarch-build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
repository_dispatch:
|
||||||
|
types:
|
||||||
|
- cron-trigger-action
|
||||||
|
- config-trigger-action
|
||||||
|
- client-trigger-action
|
||||||
|
- server-trigger-action
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_PATH: "/install/docker"
|
||||||
|
REPO: "onlyoffice"
|
||||||
|
DOCKER_IMAGE_PREFIX: "4testing-docspace"
|
||||||
|
DOCKERFILE: "Dockerfile.app"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform: [linux/amd64]
|
||||||
|
branch: ${{ github.event.client_payload.branches }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ matrix.branch }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Free Disk Space
|
||||||
|
run: |
|
||||||
|
sudo rm -rf /usr/local/lib/android /opt/ghc
|
||||||
|
sudo docker image prune --all --force
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build 4testing
|
||||||
|
run: |
|
||||||
|
cd .${DOCKER_PATH}
|
||||||
|
if [ "${{ matrix.branch }}" = "develop" ]; then
|
||||||
|
DOCKER_TAG="develop.${{ github.run_number }}"
|
||||||
|
else
|
||||||
|
DOCKER_TAG=$(echo "${{ matrix.branch }}" | sed '/^release\b\|^hotfix\b\|^feature\b/s/release.*\/\|hotfix.*\/\|feature.*\///; s/-git-action$//; s/^v//').${{github.run_number}}
|
||||||
|
fi
|
||||||
|
export DOCKER_TAG
|
||||||
|
docker buildx bake -f build.yml \
|
||||||
|
--set *.args.GIT_BRANCH=${{ matrix.branch }} \
|
||||||
|
--set *.platform=linux/amd64 \
|
||||||
|
--push
|
||||||
|
shell: bash
|
Loading…
Reference in New Issue
Block a user