diff options
| author | Asko Nomm <asko@bien.ee> | 2022-02-26 21:34:00 +0100 |
|---|---|---|
| committer | Asko Nomm <asko@bien.ee> | 2022-02-26 21:34:00 +0100 |
| commit | 2a4f9713dfd545dbc7501c98b4f442a89c4db1bb (patch) | |
| tree | 607f5d0210defec7915d016160e91922f29d295f | |
| parent | 548be993c31f4b9e2333905f22058bbcb4e3ee4d (diff) | |
Add CI/CD pipeline
| -rw-r--r-- | .github/workflows/release.yml | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..929dd12 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,91 @@ +name: Release +on: + push: + branches: + - master + workflow_dispatch: + branches: + - master +jobs: + run-tests: + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: "Install PHP dependencies" + uses: php-actions/composer@v6 + + - name: "Run tests" + run: ./vendor/pestphp/pest/bin/pest + + build-zip: + runs-on: ubuntu-latest + depends-on: [run-tests] + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: paulhatch/semantic-version@v4.0.2 + id: semver + with: + # The prefix to use to identify tags + tag_prefix: "v" + # A string which, if present in a git commit, indicates that a change represents a + # major (breaking) change, supports regular expressions wrapped with '/' + major_pattern: "(MAJOR)" + # Same as above except indicating a minor change, supports regular expressions wrapped with '/' + minor_pattern: "(MINOR)" + # A string to determine the format of the version output + format: "${major}.${minor}.${patch}" + # If this is set to true, *every* commit will be treated as a new version. + bump_each_commit: true + + - run: git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline > new-in-this-release.log + + - name: Read git log + id: package + uses: juliangruber/read-file-action@v1 + with: + path: ./new-in-this-release.log + + - name: "Create Release" + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + tag_name: ${{steps.semver.outputs.version_tag}} + release_name: ${{steps.semver.outputs.version_tag}} + body: ${{ steps.package.outputs.content }} + draft: false + prerelease: false + + - name: "Install PHP dependencies" + uses: php-actions/composer@v6 + + - name: "ZIP" + uses: papeloto/action-zip@v1 + with: + files: / + dest: hird-${{steps.semver.outputs.version_tag}}.zip + + - name: "Publish" + uses: actions/upload-artifact@v2-preview + with: + name: hird-${{steps.semver.outputs.version_tag}}.zip + path: hird-${{steps.semver.outputs.version_tag}}.zip + + - name: "Upload" + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + with: + upload_url: ${{steps.create_release.outputs.upload_url}} + asset_path: hird-${{steps.semver.outputs.version_tag}}.zip + asset_name: hird-${{steps.semver.outputs.version_tag}}.zip + asset_content_type: application/zip |
