initial commit #26
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
- "*.log" | |
- ".github/**" # Recursive | |
- "test/**" # Recursive | |
- "test_driver/**" # Recursive | |
- "integration_test/**" # Recursive | |
- "README.md" | |
- "LICENSE" | |
- "CHANGELOG.md" | |
- "assets/**" # Recursive | |
- "screenshots/**" # Recursive | |
pull_request: | |
branches: "*" #all branches or [develop] # or main | |
jobs: | |
# Todo lint-job test-job build-job release-job deploy-job | |
build: | |
if: >- | |
# The following line is used to prevent forks from running this action | |
${{ github.repository == 'soufianes98/demo-project' }} | |
# If the latest commit starts with a specific word, then exit this action | |
${{ !startsWith(github.event.head_commit.message, 'ci' || 'chore' || 'build' || 'docs' || 'test' || 'style' || 'revert' || 'refactor') }} | |
${{ !contains(github.event.head_commit.message, 'initial commit' || 'first commit') }} | |
name: Build artifacts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
artifact: [artifact1.js, artifact2.txt] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create a directory | |
run: mkdir -p $HOME/Downloads/artifacts | |
- name: Build project | |
run: echo 'Hello, World! This is an artifact1!!!' > ~/Downloads/${{ matrix.artifact }} | |
- name: Uploading artifact ${{ matrix.artifact }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.artifact }} | |
path: ~/Downloads/${{ matrix.artifact }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
id-token: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Create a directory | |
run: mkdir -p ~/Downloads/artifacts | |
- name: Downloading artifact1 | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact1.js | |
path: ~/Downloads/artifacts | |
- name: Downloading artifact2 | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifact2.txt | |
path: ~/Downloads/artifacts | |
# Run this command only when tests succeed or all jobs succeed | |
# https://github.com/google-github-actions/release-please-action | |
- name: Release | |
run: | | |
export REPOSITORY_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2) | |
chmod +x scripts/release_script.sh | |
scripts/release_script.sh | |
env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }} | |
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} | |
USERNAME: ${{ github.repository_owner }} |