Update Heatpump and Changelog Version from Release #27
Workflow file for this run
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: Update Heatpump and Changelog Version from Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
update_version: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub Actions token | |
DEFAULT_NAME: "github-actions[bot]" | |
DEFAULT_EMAIL: "github-actions[bot]@users.noreply.github.com" | |
TARGET_BRANCH: "master-york-with-automations" # Target branch name | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 # Use the latest version | |
with: | |
fetch-depth: 0 # Fetch all branches and history | |
- name: Check Current Directory | |
run: | | |
echo "Current directory:" | |
pwd # Print current directory | |
echo "Listing files:" | |
ls -l # List files in the current directory | |
- name: List files in .github/scripts | |
run: | | |
echo "Listing files in .github/scripts/" | |
ls -l .github/scripts/ | |
- name: Install Python | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3 python3-pip | |
- name: Install PyYAML | |
run: | | |
pip3 install pyyaml # Use pip3 to install for Python 3 | |
- name: Set Git Config | |
run: | | |
echo "Using NAME: ${{ env.DEFAULT_NAME }}" | |
echo "Using EMAIL: ${{ env.DEFAULT_EMAIL }}" | |
git config --local user.email "${{ env.DEFAULT_EMAIL }}" | |
git config --local user.name "${{ env.DEFAULT_NAME }}" | |
- name: Checkout target branch | |
run: | | |
git fetch origin ${{ env.TARGET_BRANCH }} # Fetch the latest target branch | |
git checkout ${{ env.TARGET_BRANCH }} # Checkout the target branch | |
- name: List files in .github/scripts after checkout | |
run: | | |
echo "Listing files in .github/scripts/ after checkout" | |
ls -l .github/scripts/ | |
- name: Update Version | |
run: | | |
python3 .github/scripts/update_version.py ${{ github.event.release.tag_name }} | |
- name: Commit Changes | |
run: | | |
git add heatpump.yaml CHANGELOG.md | |
git commit -m "Update version to ${{ github.event.release.tag_name }}" | |
git push origin HEAD:${{ env.TARGET_BRANCH }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |