Skip to content

Bit more work on the move command #30

Bit more work on the move command

Bit more work on the move command #30

name: Release Workflow
on: [push]
jobs:
release-management:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # Checkout the correct branch name
fetch-depth: 0 # Fetch the whole repo history
# Documentation: https://github.com/actions/checkout
# Explanation: This step checks out the source code from the GitHub repository, ensuring that the workflow has access to the latest version of the code.
# Step 2: Install PHP extensions
- name: Set up PHP and install extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: zip, gd
# Documentation: https://github.com/shivammathur/setup-php
# Explanation: This step sets up PHP 7.4 and installs the required extensions (`zip` and `gd`) that are necessary for your Composer dependencies.
# Step 3: Install Node.js dependencies using npm
- name: Install npm dependencies
uses: actions/setup-node@v3
with:
node-version: '18.x' # Specify Node.js version
# Documentation: https://github.com/actions/setup-node
# Explanation: This step sets up a Node.js environment and installs the project's dependencies listed in the `package.json` file using npm.
- run: npm install
# Documentation: https://docs.npmjs.com/cli/v7/commands/npm-install
# Explanation: This step runs `npm install` to install the Node.js dependencies required for the project.
# Step 4: Install PHP dependencies using Composer
- name: Install Composer dependencies
run: composer install --no-progress --no-interaction --prefer-dist --ignore-platform-req=ext-zip --ignore-platform-req=ext-gd
env:
COMPOSER_ROOT_VERSION: 2.7.7
# Documentation: https://getcomposer.org/doc/03-cli.md#install
# Explanation: This step runs `composer install` to install the PHP dependencies required for the project. It also ignores platform requirements for `ext-zip` and `ext-gd` to avoid issues if extensions are not detected correctly in the environment.
# Step 5: Generate Git version information
- name: Git Version
id: version
uses: codacy/[email protected]
with:
release-branch: main
# Documentation: https://github.com/marketplace/actions/git-version
# Explanation: This step calculates the version of the software based on the Git tags and branch information, storing the result in the `version` output.
# Step 6: Extract repository description
- name: Extract repository description
id: repo-description
run: |
description=$(jq -r '.description' <(curl -s https://api.github.com/repos/${{ github.repository }}))
echo "REPO_DESCRIPTION=$description" >> $GITHUB_ENV
# Documentation: https://docs.github.com/en/rest/reference/repos#get-a-repository
# Explanation: This step retrieves the description of the GitHub repository using the GitHub API and stores it in the environment variables.
# Step 7: Run Changelog CI
- name: Run Changelog CI
uses: saadmk11/[email protected]
with:
release_version: ${{ steps.version.outputs.version }}
config_file: changelog-ci-config.json
# Documentation: https://github.com/saadmk11/changelog-ci
# Explanation: This step generates a changelog for the current release using the Changelog CI tool.
# Step 8: Output the version
- name: Use the version
run: |
echo ${{ steps.version.outputs.version }}
# Explanation: This step outputs the calculated version number to the console for reference.
# Step 9: Output the version
- name: Move the file around
run: |
mkdir -p opencatalogi && find . -maxdepth 1 ! -path './opencatalogi' ! -path '.' -exec mv -t opencatalogi {} +
# find . -type f \( -name '*.git*' -o -name '*.vscode*' -o -name '*.coverage-frontend*' -o -name '*.docker*' -o -name '*.tests*' -o -name '*.docs*' -o -name '*.specs.ts*' -o -name '*.mocks.ts*' -o -name '*.babelrc' -o -name '*.nvmrc' -o -name '*.php-cs-fixer.dist.php' -o -name '*.phpunit.result.cache' -o -name '*.prettierrc' -o -name 'changelog-ci-config.json' -o -name 'composer-setup.php' -o -name 'coverage.txt' -o -name 'docker-compose.yml' -o -name '*.editorconfig' -o -name '*.jest.config.js' -o -name '*.eslintrc.js' -o -name 'phpmd.xml' -o -name 'phpunit.xml' -o -name 'psalm.xml' -o -name 'stylelint.config.js' -o -name 'webpack.config.js' \) -exec rm -f {} +
# Explanation: This step outputs the calculated version number to the console for reference.
#Step 2: Create the .tar.gz archive
- name: Create Tarball
run: |
tar -czvf packadge.tar.gz .
- name: Upload Tarball
uses: actions/upload-artifact@v3
with:
name: tar packadge
path: packadge.tar.gz
- name: Create ZIP
run: |
zip -r packadge.zip .
- name: Upload ZIP
uses: actions/upload-artifact@v3
with:
name: zip packadge
path: packadge.zip
# Step 10: Create a new release on GitHub
- name: Create GitHub Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.version.outputs.version }}
prerelease: false
title: "Release ${{ steps.version.outputs.version }}"
files: |
opencatalogi/LICENSE.md
packadge.zip
packadge.tar.gz
# Documentation: https://github.com/marvinpinto/action-automatic-releases
# Explanation: This step creates a new release on GitHub, uploading the generated release files, and tagging the release with the calculated version.