Merge pull request #3 from testainers/dev #4
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: Main Release | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
contents: write | |
steps: | |
- name: Code Checkout | |
uses: actions/checkout@v4 | |
- name: Get Pubspec Version | |
id: version-step | |
run: | | |
export VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+') | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Check if version is used | |
run: | | |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }} | |
echo "$URL" | |
CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL") | |
if [ "$CODE" != 404 ]; then | |
echo "Release '$VERSION' already exists. ($CODE)" | |
exit 1 | |
fi | |
- name: Flutter Environment | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Flutter Config | |
timeout-minutes: 2 | |
run: flutter config --no-analytics --no-animations | |
- name: Flutter Pub Get | |
timeout-minutes: 2 | |
run: flutter pub get | |
- name: Flutter Build Web | |
timeout-minutes: 10 | |
run: flutter build web | |
- name: Publishing to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./build/web | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Creating a GitHub Tag | |
uses: mathieudutour/[email protected] | |
with: | |
custom_tag: ${{ env.VERSION }} | |
tag_prefix: '' | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |