Skip to content

Update main.yml

Update main.yml #19

Workflow file for this run

# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches:
- main
- development
- staging
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Show variable
run: |
echo "Deploying the site: ${{ vars.APP_URL }}"
- name: Increment version from repository's tags
id: semver-tags
uses: SOLIDSoftworks/semver-tags@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag-prefix: 'stg-'
default-version: 'stg-0.0.0'
- name: Create new tag
run: |
new_tag=${{ steps.semver-tags.outputs.core-version }}
git tag $new_tag
git push origin $new_tag
- name: Generate changelog
id: changelog
run: |
prev_tag=${{ steps.semver-tags.outputs.previous-version }}
new_tag=${{ steps.semver-tags.outputs.core-version }}
log=$(git log --pretty=format:"%h - %s (%an, %ad)" $prev_tag..HEAD)
echo "body=$log" >> $GITHUB_ENV
- name: Create and publish release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.semver-tags.outputs.core-version }}
release_name: Staging Release ${{ steps.semver-tags.outputs.core-version }}
body: |
Changes:
${{ env.body }}
draft: false
prerelease: true
- name: Deploy to ${{ github.ref_name }} environment
run: |
echo "Deploying to ${{ github.ref_name }} environment"
# Your deploy script/commands here