Update from https://github.com/Jason2866/Tasmota-specials/commit/180d… #174
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: devel_release_firmware | |
on: | |
push: | |
paths: | |
- 'trigger_devel.txt' | |
# Ensures that only one deploy task per branch/environment will run at a time. | |
concurrency: | |
group: environment-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
save_repo: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: firmware | |
- name: Save repo as artifact | |
run: | | |
rsync -avR ./ artifact | |
rm -rf artifact/.git | |
- name: Upload repo as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: firmware | |
path: artifact | |
empty_branch: | |
needs: save_repo | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: firmware | |
- name: Create new empty firmware branch | |
run: | | |
git config --global user.email github-actions@github.com | |
git config --global user.name github-actions | |
git switch --orphan new_branch # create empty branch | |
git commit --allow-empty -m "Initial commit" | |
git push -u origin new_branch # push empty branch in repo | |
git switch firmware | |
git reset --hard new_branch # reset firmware branch | |
git push origin firmware -f | |
git push origin --delete new_branch # delete empty_branch | |
release_restore: | |
needs: empty_branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.MASTER_ACCESS_TOKEN }} | |
ref: firmware | |
- name: Download repo artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: firmware | |
path: artifact | |
- name: Display structure of downloaded files | |
run: | | |
ls -R | |
- name: Move files back | |
run: | | |
rsync -avR artifact/./ ./ | |
rm -rf artifact | |
rm tag_latest.txt 2> /dev/null || echo > /dev/null | |
- name: Build Tag and commit message | |
run: | | |
tas_com_tmp1=$(curl https://raw.githubusercontent.com/arendst/tmp_copy/action-development/trigger.txt) | |
tas_com_tmp="Based on https://github.com/arendst/Tasmota/commit/${tas_com_tmp1}" | |
tag_name_tmp="$(date -I).d.$tas_com_tmp1" | |
echo "$tas_com_tmp" >> release-info.txt | |
echo "$tag_name_tmp" >> tag_latest.txt | |
echo "$tag_name_tmp" >> tag.txt | |
echo "tas_com=$tas_com_tmp" >> $GITHUB_ENV | |
echo "tag_name=$tag_name_tmp" >> $GITHUB_ENV | |
- name: Update Manifest files | |
run: | | |
mkdir manifest_release | |
python genManifest.py | |
python genManifestWithFeatureas.py | |
python genManifestRelease.py | |
- name: Release devel firmwares | |
uses: jason2866/action-gh-release@v1.2 | |
with: | |
tag_name: ${{ env.tag_name }} | |
body_path: release-info.txt | |
prerelease: true | |
files: | | |
tag_latest.txt | |
tag.txt | |
manifests_release.json | |
manifest_release/development* | |
manifest_release/unofficial* | |
firmware/development/* | |
firmware/unofficial/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.MASTER_ACCESS_TOKEN }} | |
- name: Remove not needed files stored in repo | |
run: | | |
rm -rf release-info.txt | |
rm -rf manifests_release.json | |
rm -rf manifest_release | |
- name: Push artifact content in branch firmware | |
run: | | |
git config user.email github-actions@github.com | |
git config user.name "github-actions" | |
git add -A | |
git commit --allow-empty -m "${{ env.tas_com }}" | |
git push origin firmware -f | |
deploy: | |
needs: release_restore | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: firmware | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: '.' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |