diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8150975..cd15956 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,81 +1,17 @@ name: Continuous Integration on: push: + branches: + - 'main' + - 'master' + - 'refs/heads/v[0-9]+.[0-9]+.[0-9]+' pull_request: +## This workflow needs the `pull-request` permissions to work for the package diffing +## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions +permissions: + pull-requests: write + contents: read jobs: - generate-checks-strategy: - name: Generate Checks - runs-on: ubuntu-latest - outputs: - check: ${{ steps.generate-checks-strategy.outputs.check }} - steps: - - uses: actions/checkout@v1 - - id: generate-checks-strategy - name: Generate check - run: | - printf "Checks found: %s\r\n" $(make task-list-ci) - printf "::set-output name=check::%s" $(make task-list-ci) - lint: - runs-on: ubuntu-latest - steps: - - name: Lint Code Base - uses: docker://github/super-linter:v2.2.0 - composer-install: - strategy: - fail-fast: false - matrix: - php: [7.4, 8.0-rc] - composer: [current, highest] - needs: lint - runs-on: ubuntu-latest - container: - image: wyrihaximusnet/php:${{ matrix.php }}-nts-alpine3.12-dev-root - steps: - - uses: actions/checkout@v1 - - name: Cache composer packages - uses: actions/cache@v1 - with: - path: ./vendor/ - key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - - name: Install Dependencies - run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o - if: matrix.composer == 'lowest' - - name: Install Dependencies - run: composer install --ansi --no-progress --no-interaction --prefer-dist -o - if: matrix.composer == 'current' - - name: Install Dependencies - run: composer update --ansi --no-progress --no-interaction --prefer-dist -o - if: matrix.composer == 'highest' - qa: - strategy: - fail-fast: false - matrix: - php: [7.4, 8.0-rc] - composer: [current, highest] - check: ${{ fromJson(needs.generate-checks-strategy.outputs.check) }} - needs: - - composer-install - - generate-checks-strategy - runs-on: ubuntu-latest - container: - image: wyrihaximusnet/php:${{ matrix.php }}-nts-alpine3.12-dev-root - steps: - - uses: actions/checkout@v1 - - name: Cache composer packages - uses: actions/cache@v1 - with: - path: ./vendor/ - key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} - - name: Install Dependencies - run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o - if: matrix.composer == 'lowest' - - name: Install Dependencies - run: composer install --ansi --no-progress --no-interaction --prefer-dist -o - if: matrix.composer == 'current' - - name: Install Dependencies - run: composer update --ansi --no-progress --no-interaction --prefer-dist -o - if: matrix.composer == 'highest' - - name: Fetch Tags - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true - if: matrix.check == 'backward-compatibility-check' - - run: make ${{ matrix.check }} + ci: + name: Continuous Integration + uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main diff --git a/.github/workflows/craft-release.yaml b/.github/workflows/craft-release.yaml deleted file mode 100644 index 0166771..0000000 --- a/.github/workflows/craft-release.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: Create Release -env: - MILESTONE: ${{ github.event.milestone.title }} -on: - milestone: - types: - - closed -jobs: - wait-for-status-checks: - name: Wait for status checks - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - run: sleep 13 - - name: 'Wait for status checks' - id: waitforstatuschecks - uses: "WyriHaximus/github-action-wait-for-status@master" - with: - ignoreActions: "Wait for status checks" - checkInterval: 5 - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - id: generate-version-strategy - if: steps.waitforstatuschecks.outputs.status != 'success' - name: Fail - run: exit 1 - generate-changelog: - name: Generate Changelog - needs: - - wait-for-status-checks - runs-on: ubuntu-latest - outputs: - changelog: ${{ steps.changelog.outputs.changelog }} - steps: - - name: Generate changelog - uses: WyriHaximus/github-action-jwage-changelog-generator@v1 - id: changelog - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - milestone: ${{ env.MILESTONE }} - - name: Show changelog - run: echo "${CHANGELOG}" - env: - CHANGELOG: ${{ steps.changelog.outputs.changelog }} - create-release: - name: Create Release - needs: - - generate-changelog - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - env: - CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }} - - run: | - echo -e "${MILESTONE_DESCRIPTION}\r\n\r\n${CHANGELOG}" > release-${{ env.MILESTONE }}-release-message.md - cat release-${{ env.MILESTONE }}-release-message.md - release_message=$(cat release-${{ env.MILESTONE }}-release-message.md) - release_message="${release_message//'%'/'%25'}" - release_message="${release_message//$'\n'/'%0A'}" - release_message="${release_message//$'\r'/'%0D'}" - echo "::set-output name=release_message::$release_message" - id: releasemessage - env: - MILESTONE_DESCRIPTION: ${{ github.event.milestone.description }} - CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }} - - name: Create Reference Release with Changelog - uses: fleskesvor/create-release@feature/support-target-commitish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.MILESTONE }} - release_name: ${{ env.MILESTONE }} - body: ${{ steps.releasemessage.outputs.release_message }} - draft: false - prerelease: false diff --git a/.github/workflows/release-managment.yaml b/.github/workflows/release-managment.yaml new file mode 100644 index 0000000..c49b362 --- /dev/null +++ b/.github/workflows/release-managment.yaml @@ -0,0 +1,23 @@ +name: Release Management +on: + pull_request: + types: + - opened + - labeled + - unlabeled + - synchronize + - reopened + milestone: + types: + - closed +permissions: + contents: write + issues: write + pull-requests: write +jobs: + release-managment: + name: Create Release + uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main + with: + milestone: ${{ github.event.milestone.title }} + description: ${{ github.event.milestone.title }} diff --git a/.github/workflows/set-milestone-on-pr.yaml b/.github/workflows/set-milestone-on-pr.yaml deleted file mode 100644 index 571f5ce..0000000 --- a/.github/workflows/set-milestone-on-pr.yaml +++ /dev/null @@ -1,70 +0,0 @@ -name: Set Milestone -on: - pull_request: - types: - - assigned - - opened - - synchronize - - reopened - - edited - - ready_for_review - - review_requested -jobs: - set-milestone: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - if: github.event.pull_request.milestone == null - - name: 'Get Previous tag' - if: github.event.pull_request.milestone == null - id: previoustag - uses: "WyriHaximus/github-action-get-previous-tag@master" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: 'Get next minor version' - if: github.event.pull_request.milestone == null - id: semvers - uses: "WyriHaximus/github-action-next-semvers@master" - with: - version: ${{ steps.previoustag.outputs.tag }} - - name: 'Get Milestones' - if: github.event.pull_request.milestone == null - uses: "WyriHaximus/github-action-get-milestones@master" - id: milestones - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - run: printf "::set-output name=number::%s" $(printenv MILESTONES | jq --arg MILESTONE $(printenv MILESTONE) '.[] | select(.title == $MILESTONE) | .number') - if: github.event.pull_request.milestone == null - id: querymilestone - env: - MILESTONES: ${{ steps.milestones.outputs.milestones }} - MILESTONE: ${{ steps.semvers.outputs.minor }} - - name: 'Create Milestone' - if: github.event.pull_request.milestone == null && steps.querymilestone.outputs.number == '' - id: createmilestone - uses: "WyriHaximus/github-action-create-milestone@master" - with: - title: ${{ steps.semvers.outputs.minor }} - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: 'Select found or created Milestone' - if: github.event.pull_request.milestone == null - id: selectmilestone - run: | - if [ $(echo ${QUERY_NUMBER} | wc -c) -eq 1 ] ; then - printf "::set-output name=number::%s" "${CREATED_NUMBER}" - exit 0 - fi - - printf "::set-output name=number::%s" "${QUERY_NUMBER}" - env: - CREATED_NUMBER: ${{ steps.createmilestone.outputs.number }} - QUERY_NUMBER: ${{ steps.querymilestone.outputs.number }} - - name: 'Set Milestone' - if: github.event.pull_request.milestone == null - uses: "WyriHaximus/github-action-set-milestone@master" - with: - issue_number: ${{ github.event.pull_request.number }} - milestone_number: ${{ steps.selectmilestone.outputs.number }} - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"