style: fix Prettier formatting issues #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Pipeline | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to release (e.g., v1.0.0)' | ||
| required: true | ||
| type: string | ||
| env: | ||
| NODE_VERSION: '18' | ||
| jobs: | ||
| # Create Release | ||
| create-release: | ||
| name: Create Release | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
| version: ${{ steps.get_version.outputs.version }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get version | ||
| id: get_version | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | ||
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run tests | ||
| run: npm run test | ||
| - name: Build application | ||
| run: npm run build | ||
| - name: Generate changelog | ||
| id: changelog | ||
| run: | | ||
| # Generate changelog from git commits | ||
| echo "## What's Changed" > CHANGELOG.md | ||
| echo "" >> CHANGELOG.md | ||
| git log --oneline --pretty=format:"- %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> CHANGELOG.md | ||
| echo "" >> CHANGELOG.md | ||
| echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$(git describe --tags --abbrev=0 HEAD^)...${{ steps.get_version.outputs.version }}" >> CHANGELOG.md | ||
| - name: Create Release | ||
| id: create_release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: ${{ steps.get_version.outputs.version }} | ||
| release_name: Release ${{ steps.get_version.outputs.version }} | ||
| body_path: CHANGELOG.md | ||
| draft: false | ||
| prerelease: ${{ contains(steps.get_version.outputs.version, 'beta') || contains(steps.get_version.outputs.version, 'alpha') }} | ||
| # Build and Upload Assets | ||
| build-assets: | ||
| name: Build and Upload Assets | ||
| runs-on: ubuntu-latest | ||
| needs: create-release | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Build application | ||
| run: npm run build | ||
| - name: Create deployment package | ||
| run: | | ||
| mkdir -p release | ||
| cp -r .next release/ | ||
| cp -r public release/ | ||
| cp package.json release/ | ||
| cp package-lock.json release/ | ||
| cp next.config.js release/ | ||
| cp -r src release/ | ||
| tar -czf securiace-website-${{ needs.create-release.outputs.version }}-${{ matrix.os }}.tar.gz -C release . | ||
| - name: Upload Release Asset | ||
| uses: actions/upload-release-asset@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
| asset_path: ./securiace-website-${{ needs.create-release.outputs.version }}-${{ matrix.os }}.tar.gz | ||
| asset_name: securiace-website-${{ needs.create-release.outputs.version }}-${{ matrix.os }}.tar.gz | ||
| asset_content_type: application/gzip | ||
| # Deploy to Staging | ||
| deploy-staging: | ||
| name: Deploy to Staging | ||
| runs-on: ubuntu-latest | ||
| needs: [create-release, build-assets] | ||
| if: contains(needs.create-release.outputs.version, 'beta') || contains(needs.create-release.outputs.version, 'alpha') | ||
| environment: staging | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Deploy to staging | ||
| run: | | ||
| echo "Deploying ${{ needs.create-release.outputs.version }} to staging" | ||
| # Add staging deployment commands here | ||
| - name: Run smoke tests | ||
| run: | | ||
| echo "Running smoke tests on staging" | ||
| # Add smoke test commands here | ||
| # Deploy to Production | ||
| deploy-production: | ||
| name: Deploy to Production | ||
| runs-on: ubuntu-latest | ||
| needs: [create-release, build-assets] | ||
| if: !contains(needs.create-release.outputs.version , 'beta') && !contains(needs.create-release.outputs.version, 'alpha') | ||
| environment: production | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Deploy to production | ||
| run: | | ||
| echo "Deploying ${{ needs.create-release.outputs.version }} to production" | ||
| # Add production deployment commands here | ||
| - name: Run smoke tests | ||
| run: | | ||
| echo "Running smoke tests on production" | ||
| # Add smoke test commands here | ||
| - name: Notify deployment | ||
| uses: 8398a7/action-slack@v3 | ||
| with: | ||
| status: success | ||
| channel: '#deployments' | ||
| webhook_url: ${{ secrets.SLACK_WEBHOOK }} | ||
| env: | ||
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
| # Update Documentation | ||
| update-docs: | ||
| name: Update Documentation | ||
| runs-on: ubuntu-latest | ||
| needs: [create-release, deploy-production] | ||
| if: !contains(needs.create-release.outputs.version , 'beta') && !contains(needs.create-release.outputs.version, 'alpha') | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Update documentation | ||
| run: | | ||
| echo "Updating documentation for ${{ needs.create-release.outputs.version }}" | ||
| # Add documentation update commands here | ||
| - name: Commit documentation updates | ||
| run: | | ||
| git config --local user.email "action@github.com" | ||
| git config --local user.name "GitHub Action" | ||
| git add . | ||
| git commit -m "docs: update documentation for ${{ needs.create-release.outputs.version }}" || exit 0 | ||
| git push | ||