Making script posix complicant #36
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: Build Fastboot Flasher | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'installer.bat' | |
- 'installer.sh' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: git config --global --add safe.directory /github/workspace | |
- name: Get current date and commit hash | |
id: version | |
run: | | |
DATE=$(date +'%Y%m%d') | |
VERSION="v3-${DATE}" | |
echo "version=$VERSION" >> $GITHUB_ENV | |
- name: Set Git user info | |
run: | | |
git config user.email "jefinojacob9488@gmail.com" | |
git config user.name "Jefino9488" | |
- name: Download latest Linux platform tools | |
run: | | |
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip -O platform-tools-linux.zip | |
mkdir -p tools/linux | |
unzip platform-tools-linux.zip -d tools/linux | |
- name: Download latest Windows platform tools | |
run: | | |
wget https://dl.google.com/android/repository/platform-tools-latest-windows.zip -O platform-tools-windows.zip | |
mkdir -p tools/windows | |
unzip platform-tools-windows.zip -d tools/windows | |
- name: Prepare files for zip | |
run: | | |
mkdir -p fastbootflasher/tools | |
cp -r tools/linux fastbootflasher/tools/ | |
cp -r tools/windows fastbootflasher/tools/ | |
cp installer.bat fastbootflasher/ | |
cp installer.sh fastbootflasher/ | |
- name: Create zip file | |
run: | | |
cd fastbootflasher | |
zip -r ../fastbootflasher-${{ env.version }}.zip * | |
- name: Create Release Notes | |
run: | | |
echo "## Release Notes" > release_notes.txt | |
echo "- Built Fastboot Flasher from commit ${{ github.sha }}" >> release_notes.txt | |
echo "- Version: ${{ env.version }}" >> release_notes.txt | |
- name: Create release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: fastbootflasher-${{ env.version }}.zip | |
tag: "${{ env.version }}" | |
name: "Fastboot Flasher ${{ env.version }}" | |
allowUpdates: true | |
makeLatest: true | |
bodyFile: release_notes.txt | |
token: ${{ secrets.GITHUB_TOKEN }} |