Skip to content

USe KEY from github secrets #9

USe KEY from github secrets

USe KEY from github secrets #9

name: learn-github-actions
on: [push]
jobs:
run-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: php my-app.php
coding_standards:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if file begins with "//"
run: |
# Set the file path you want to check
FILE_PATH="my-app.php"
# Check if the file begins with "//"
if [[ "$(head -n 1 "$FILE_PATH")" == "<?php"* ]]; then
echo "File begins with '<?php'."
else
echo "File does not begin with '<?php'."
exit 1
fi
deploy:
if: contains( github.ref, 'main')
runs-on: ubuntu-latest
needs: [run-app,coding_standards]
steps:
- uses: actions/checkout@v4
- run: |
echo "Starting deployment simulator..."
echo "Step 1: Preparing deployment..."
sleep 2 # Simulate a 2-second step
echo "Step 2: Deploying application using api key ${{ secrets.DEPLOY_KEY }}"
sleep 3 # Simulate a 3-second step
echo "Deployment complete."