-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcc-keep-translated-posts-status-same-as-original-plugin-release.yml
More file actions
137 lines (111 loc) · 4.63 KB
/
bcc-keep-translated-posts-status-same-as-original-plugin-release.yml
File metadata and controls
137 lines (111 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# This is a basic workflow to help you get started with Actions
name: bcc-keep-translated-posts-status-same-as-original plugin
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths:
- plugins/bcc-keep-translated-posts-status-same-as-original/**
- .github/workflows/bcc-keep-translated-posts-status-same-as-original-plugin-release.yml
tags-ignore:
- '**'
pull_request:
branches: [ master ]
paths:
- plugins/bcc-keep-translated-posts-status-same-as-original/**
- .github/workflows/bcc-keep-translated-posts-status-same-as-original-plugin-release.yml
tags-ignore:
- '**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
name: Lint PHP - validate code
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
working-directory: ./plugins/bcc-keep-translated-posts-status-same-as-original
steps:
- uses: actions/checkout@v6
# This config file gets auto-loaded by PHPStan
- name: Set PHPStan config
run: |
cat <<'EOF' > phpstan.neon
parameters:
level: 1 # form 0 to 11 where 0 is the loosest and 11 the strictest
errorFormat: github
paths:
- .
excludePaths:
- vendor
scanFiles:
- dependencies.stub
# One can ignore errors like this
# ignoreErrors:
# - '#Path in require\(\) "build/.+\.asset\.php" is not a file or it does not exist\.#'
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
EOF
- name: Install PHPStan and Wordpress-stub
run: |
composer require --dev phpstan/phpstan
composer require --dev szepeviktor/phpstan-wordpress
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress
build:
needs: lint
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v6
- name: Get Package Version
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'plugins/bcc-keep-translated-posts-status-same-as-original/package.json'
prop_path: 'version'
- name: Get Previous Updated
id: lastupdated
uses: notiz-dev/github-action-json-property@release
with:
path: 'plugins/bcc-keep-translated-posts-status-same-as-original/package.json'
prop_path: 'last_updated'
# Runs a set of commands using the runners shell
- id: build-and-zip
name: Build and Zip Plugin
run: |
# Build javascript
yarn install --frozen-lockfile
cd plugins/bcc-keep-translated-posts-status-same-as-original
yarn build
# Get package version
package_version=${{steps.version.outputs.prop}}
previous_date="${{steps.lastupdated.outputs.prop}}"
current_date=$(date -u +'%Y-%m-%d %H:%M:%S')
build_version="$(echo $package_version | sed -re 's/([0-9]+\.[0-9]+\.)[0-9]+/\1/')${GITHUB_RUN_NUMBER}"
sed -i "s|$package_version|$build_version|g" package.json
sed -i "s|$previous_date|$current_date|g" package.json
sed -i "s|<VERSION>|$build_version|g" bcc-keep-translated-posts-status-same-as-original.php
sed -i "s|$package_version|$build_version|g" bcc-keep-translated-posts-status-same-as-original.php
git config user.name "bcc-bot"
git config user.email "<>"
git tag "version-bump-v${build_version}"
git commit -am "Released bcc-keep-translated-posts-status-same-as-original plugin v${build_version}"
git push
cd ..
zip -r bcc-keep-translated-posts-status-same-as-original.zip bcc-keep-translated-posts-status-same-as-original
cd ..
echo "::set-output name=tag_name::bcc-keep-translated-posts-status-same-as-original-v${build_version}"
- uses: ncipollo/release-action@v1
name: Create Release
with:
artifacts: "plugins/bcc-keep-translated-posts-status-same-as-original.zip"
tag: ${{steps.build-and-zip.outputs.tag_name}}
token: ${{ secrets.GITHUB_TOKEN }}