Update layout #48
This file contains hidden or 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 and Release | |
| on: | |
| # push: | |
| # branches: | |
| # - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout the code | |
| uses: actions/checkout@v4 | |
| - name: Set up Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.24.x" | |
| channel: "stable" | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate code | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Build web | |
| run: flutter build web --release --base-href="/json_editor/" | |
| - name: Upload Web Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build-sdet | |
| path: build/web | |
| - name: Create a simple file | |
| run: echo "This is a simple file created by GitHub Actions." > simple-file.txt | |
| - name: Upload the file as an artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: simple-file | |
| path: simple-file.txt | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| needs: build-and-deploy | |
| permissions: write-all | |
| # contents: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: List files in current directory | |
| run: | | |
| ls -al | |
| - name: Download Web Build Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-build-sdet | |
| path: ./build/web | |
| - name: Download Simple File Artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: simple-file | |
| - name: List files in current directory | |
| run: | | |
| ls -al | |
| cd build/web | |
| ls -al | |
| - name: Install GitHub CLI | |
| run: sudo apt-get install gh | |
| - name: List | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # GitHub CLI api | |
| # https://cli.github.com/manual/gh_api | |
| gh api \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| /repos/Zander-K/pipelines/releases | |
| - name: Zip Web Build | |
| run: zip -r web-build.zip ./build/web | |
| - name: Zip Web Build 2 | |
| run: zip -r web-build-copy.zip ./build/web | |
| - name: Create Release in Another Repo | |
| env: | |
| GH_TOKEN: ${{ secrets.RELEASE_REPO_SECRET }} | |
| run: | | |
| gh release create v1.0.5 ./simple-file.txt ./web-build.zip web-build-copy.zip \ | |
| --repo Zander-K/pipelines \ | |
| --title "Release 1.0.5" \ | |
| --notes "This is a release of the app build." | |