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

Updated workflow #1

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 21 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Pull Request Check
on:
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
jobs:
ci:
name: CI
uses: ponlawat-w/moodle-local_accessibility/.github/workflows/ci.yml@master
with:
widget-textcolour-branch: ${{ github.ref }}
ci-finished:
name: CI Finished
needs: ci
runs-on: ubuntu-latest
steps:
- run: exit 0
57 changes: 26 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Moodle Accessibility Text Colour Widget Releasing
name: Release

on:
push:
Expand All @@ -7,50 +7,45 @@ on:

jobs:

ci:
name: CI
uses: ponlawat-w/moodle-local_accessibility/.github/workflows/ci.yml@master
with:
widget-textcolour-branch: ${{ github.ref }}

get-version:
name: Get version info
uses: ponlawat-w/moodle-local_accessibility/.github/workflows/get-version.yml@master
with:
ref: ${{ github.ref }}

release:
name: Release

needs: [ci, get-version]
runs-on: ubuntu-latest

steps:

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions:
ini-values: max_input_vars=5000
coverage: none

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

- name: Get Plugin Information
id: plugin-info
run: php -r 'define("MOODLE_INTERNAL",1);define("MATURITY_ALPHA",50);define("MATURITY_BETA",100);define("MATURITY_RC",150);define("MATURITY_STABLE",200);define("ANY_VERSION","any");$plugin=new stdClass();include_once("version.php");$plugin->maturity!=200&&throw new Exception("Requires plugin maturity to be stable to release!");echo "PLUGIN_COMPONENT=".(isset($plugin->component)?$plugin->component:"")."\nPLUGIN_RELEASE=".(isset($plugin->release)?$plugin->release:"")."\nPLUGIN_VERSION=".(isset($plugin->version)?$plugin->version:"")."\nPLUGIN_REQUIRES=".(isset($plugin->requires)?$plugin->requires:"")."\nPLUGIN_MATURITY=".(isset($plugin->maturity)?$plugin->maturity:"")."\nPLUGIN_DEPENDENCIES=".(isset($plugin->dependencies)?json_encode($plugin->dependencies):"{}");' >> $GITHUB_OUTPUT

- name: Get Branch Name
id: get-branch
run: php -r 'echo "BRANCH_NAME=".preg_replace("/(\\(|\\))/", "", strtolower(str_replace(" ", "-", preg_replace("/(\\d+)\\.(\\d+)\\.(\\d+)(.*)/","v$1.$2$4", "${{ steps.plugin-info.outputs.PLUGIN_RELEASE }}"))));' >> $GITHUB_OUTPUT

- name: Push to Branch
run: |
git checkout -b ${{ steps.get-branch.outputs.BRANCH_NAME }}
git push -f -u origin ${{ steps.get-branch.outputs.BRANCH_NAME }}
git checkout -b ${{ needs.get-version.outputs.branch-name }}
git push -f -u origin ${{ needs.get-version.outputs.branch-name }}

- name: Tag
id: tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ github.token }}
custom_tag: ${{ steps.plugin-info.outputs.PLUGIN_RELEASE }}
release_branches: ${{ github.ref_name }}
- name: Publish Tag
run: |
git config --global user.name "ponlawat-w"
git config --global user.email "[email protected]"
git tag -fa v${{ needs.get-version.outputs.plugin-release }} -m "${{ needs.get-version.outputs.plugin-release }} - ${{ needs.get-version.outputs.plugin-version }}"
git push --force origin v${{ needs.get-version.outputs.plugin-release }}

- name: Relase
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag.outputs.new_tag }}
name: ${{ steps.plugin-info.outputs.PLUGIN_RELEASE }}
body: ${{ steps.plugin-info.outputs.PLUGIN_RELEASE }} - ${{ steps.plugin-info.outputs.PLUGIN_VERSION }}
tag_name: v${{ needs.get-version.outputs.plugin-release }}
name: v${{ needs.get-version.outputs.plugin-release }}
body: ${{ needs.get-version.outputs.plugin-release }} - ${{ needs.get-version.outputs.plugin-version }}