diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml index 8f3f2c9b..c15f64f1 100644 --- a/.github/workflows/coding-style.yml +++ b/.github/workflows/coding-style.yml @@ -1,15 +1,43 @@ -name: CodingStyle +name: Coding Style on: [pull_request, workflow_dispatch] jobs: - build: - name: "Coding style check" + back: + name: "Lint Back" runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - name: Setup .NET uses: actions/setup-dotnet@v1 with: dotnet-version: 6.0.x + - name: Build the app run: cd back && dotnet build -p:CheckCodingStyle=true -p:TreatWarningsAsErrors=true '-p:SkipTranscoder=true' + + front: + name: "Lint Front" + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./front + steps: + - uses: actions/checkout@v1 + + - name: Find yarn cache + id: yarn-cache-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --immutable + + - name: Lint + run: yarn lint diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a868a7e3..d917458c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,7 +19,7 @@ jobs: - context: ./front label: front image: ghcr.io/${{github.repository_owner}}/kyoo_front - name: Docker build ${{matrix.label}} + name: Build ${{matrix.label}} steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 13f0149b..cd5afdb0 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -7,7 +7,7 @@ on: jobs: Building: - runs-on: [ubuntu-latest] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: nikeee/docfx-action@v1.0.0 diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml new file mode 100644 index 00000000..8df61573 --- /dev/null +++ b/.github/workflows/native-build.yml @@ -0,0 +1,70 @@ +name: Native build +on: push + +jobs: + update: + name: Expo Build + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./front + steps: + - name: Check for EXPO_TOKEN + run: | + if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then + echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 16.x + cache: yarn + + - name: Setup Expo + uses: expo/expo-github-action@v7 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: Restore cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --immutable + + - name: Build Mobile Release + run: yarn build:mobile --release-channel=build | tee log.txt + + - name: Parse Asset URL + id: url + run: | + ASSET_URL=$(grep -eo 'https?://expo\.io/artifacts/[^ ]+' log.txt) + echo The android url is $ASSET_URL + echo "::set-output name=assetUrl::$ASSET_URL" + + - name: Download APK Asset + run: wget -O kyoo.apk ${{ steps.url.outputs.assetUrl }} + + - uses: actions/upload-artifact@v2 + with: + name: kyoo.apk + path: ./front/kyoo.apk + + + - name: Upload Release Asset + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./example-${{ env.GITHUB_REF_SLUG }}.apk + asset_name: example-${{ env.GITHUB_REF_SLUG }}.apk + tag: ${{ github.ref } diff --git a/.github/workflows/native-update.yml b/.github/workflows/native-update.yml new file mode 100644 index 00000000..e4aa5a0a --- /dev/null +++ b/.github/workflows/native-update.yml @@ -0,0 +1,50 @@ +name: Native update +on: push + +jobs: + update: + name: Expo Update + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./front + steps: + - name: Check for EXPO_TOKEN + run: | + if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then + echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions" + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: 16.x + cache: yarn + + - name: Setup Expo + uses: expo/expo-github-action@v7 + with: + expo-version: latest + eas-version: latest + token: ${{ secrets.EXPO_TOKEN }} + + - name: Find yarn cache + id: yarn-cache-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Restore cache + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn install --immutable + + - name: Publish update + run: yarn update diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0a355bb..9d5dd511 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,17 +20,16 @@ jobs: repo-token: ${{secrets.GITHUB_TOKEN}} running-workflow-name: release allowed-conclusions: success,skipped,cancelled,neutral - # - name: Public the abstractions to nuget - # id: publish_nuget - # uses: rohith/publish-nuget@v2 - # with: - # PROJECT_FILE_PATH: Kyoo.Abstractions/Kyoo.Abstractions.csproj - # PACKAGE_NAME: Kyoo.Abstractions - # VERSION_REGEX: ^\s*(.*)<\/PackageVersion>\s*$ - # NUGET_KEY: ${{secrets.NUGET_API_KEY}} - # INCLUDE_SYMBOLS: true + - name: Download artifacts + uses: dawidd6/action-download-artifact@v2 + with: + commit: ${{env.COMMIT_SHA}} + workflow: native-build.yml + path: ./artifacts + github_token: ${{secrets.GITHUB_TOKEN}} - name: Create Release uses: ncipollo/release-action@v1 with: generateReleaseNotes: true + artifacts: ./artifacts/**/* token: ${{secrets.GITHUB_TOKEN}} diff --git a/front/apps/mobile/package.json b/front/apps/mobile/package.json index 8531c241..bf291368 100644 --- a/front/apps/mobile/package.json +++ b/front/apps/mobile/package.json @@ -8,7 +8,8 @@ "ios": "expo start --ios", "web": "expo start --web", "build": "eas build --profile production --platform android", - "build:dev": "eas build --profile development --platform android" + "build:dev": "eas build --profile development --platform android", + "update": "eas update --auto" }, "dependencies": { "@expo-google-fonts/poppins": "^0.2.2", diff --git a/front/package.json b/front/package.json index 6edb9b51..b6a9f514 100644 --- a/front/package.json +++ b/front/package.json @@ -8,6 +8,7 @@ "build:web": "yarn workspace web build", "build:mobile": "yarn workspace mobile build", "build:mobile:dev": "yarn workspace mobile build:dev", + "update": "yarn workspace mobile update", "lint": "eslint ." }, "workspaces": [