Skip to content

Commit

Permalink
feat(ci) Automatically prepare release
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre PÉRONNET <pierre.peronnet@datadoghq.com>
  • Loading branch information
holyhope committed Aug 13, 2023
1 parent c2bf267 commit 650672e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
branches: [ "main" ]

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Build release
run: composer run-script build

- name: Version
id: version
run: |-
echo P2CF_VERSION="$(composer run-script version)" >> "$GITHUB_OUTPUT"
git log $(git describe --tags --abbrev=0)..HEAD --oneline > changes.txt
- uses: ncipollo/release-action@v1
with:
artifacts: "p2cf.zip"
bodyFile: changes.txt
tag: "v${{ steps.version.outputs.P2CF_VERSION }}"
artifactErrorsFailBuild: true
draft: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ bin
*.bak
.phpunit.result.cache
junit-result.xml

build
p2cf.zip
6 changes: 6 additions & 0 deletions build.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
classes/
css/
js/
languages/*.json
languages/*.mo
vendor/
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
"./bin/install-wp-tests.sh wordpress root root localhost latest true",
"phpunit --no-interaction --log-junit junit-result.xml"
],
"build": [
"composer install --dev --prefer-dist --no-interaction --no-progress --no-suggest",
"composer run-script i18n-build",
"composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction --no-progress --no-suggest",
"composer dump-autoload --no-dev --optimize --classmap-authoritative",
"zip -9vr p2cf.zip . -i@build.lst -i *.php"
],
"test": [
"phpunit"
]
Expand Down

0 comments on commit 650672e

Please sign in to comment.