Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release builder #1616

Merged
merged 5 commits into from
Apr 16, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update release builder
mvorisek committed Apr 14, 2021
commit 27ecd439cdedc37116d4542afe2dd1e5d072ec9a
6 changes: 3 additions & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release Drafter
name: Build Docs

on:
push:
@@ -9,7 +9,7 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: toolmantim/release-drafter@v5.6.1
- name: Run Release Drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81 changes: 49 additions & 32 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
name: Bundler
name: Build Release

on: create
on:
push:
branches:
- '*.build'
- 'release/*'

jobs:
autocommit:
name: Update to stable dependencies
if: startsWith(github.ref, 'refs/heads/release/')
name: Build Release
runs-on: ubuntu-latest
container:
image: atk4/image:latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}

- name: Install PHP dependencies
run: composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: Composer unset version
run: composer config version --unset

- name: Update composer.json
run: >-
php -r '
$f = __DIR__ . "/composer.json";
$data = json_decode(file_get_contents($f), true);
foreach ($data as $k => $v) {
if (preg_match("~^(.+)-release$~", $k, $matches)) {
$data[$matches[1]] = $data[$k]; unset($data[$k]);
}
}
$str = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
echo $str;
file_put_contents($f, $str);
'
- name: Composer validate config
run: composer validate --strict --no-check-lock && composer normalize --dry-run --no-check-lock


# TODO
- uses: actions/checkout@master
- name: Update CDN destination
shell: bash
@@ -29,32 +62,7 @@ jobs:
git config --global user.name "Release Bundler"
git commit -am "Update versions for develop"
- uses: ad-m/github-push-action@master
with:
branch: feature/${{ env.version }}-version-update
force: true # in case of repeat run
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: pull-request
uses: romaninsh/pull-request@master
with:
source_branch: feature/${{ env.version }}-version-update
destination_branch: develop
pr_title: "Update to next version after release of @${{ env.version }}"
pr_body: |
Compiled JS files from last release are here:
https://cdn.jsdelivr.net/gh/atk4/ui@${{ env.version }}/public/
pr_reviewer: "romaninsh"
pr_assignee: "romaninsh"
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Update to stable dependencies
run: |
# replaces X keys with X-release keys
jq '. as $in | reduce (keys_unsorted[] | select(endswith("-release")|not)) as $k ({}; . + {($k) : (($k + "-release") as $kr | $in | if has($kr) then .[$kr] else .[$k] end) } )' < composer.json > tmp && mv tmp composer.json
composer config version --unset
# TODO

- name: Compile JS files for CDN
shell: bash
@@ -73,7 +81,16 @@ jobs:
git commit -am "Releasing $v.0"
echo "If everything is good and CI/CD pass - please manually create tag $v.0 on this commit ^^"
- uses: ad-m/github-push-action@master
- name: Commit
run: |
git config --global user.name "$(git show -s --format='%an')"
git config --global user.email "$(git show -s --format='%ae')"
git add -A && git diff --staged && git commit -m "Build Release"
- name: Push
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
branch: ${{ github.ref }}.gen
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}