Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

186 improve release ci #187

Merged
merged 38 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fe6ec90
Simple display of the version
StaehliJ Jul 25, 2023
c6779db
Read version from environment variables
StaehliJ Jul 25, 2023
b690efd
Handle nightly
StaehliJ Jul 25, 2023
8f36d12
Disable nightly when building locally.
StaehliJ Jul 25, 2023
05a9f59
Update release.yml to release on tag creation
StaehliJ Jul 25, 2023
8059198
Update release.yml
StaehliJ Jul 25, 2023
0411455
Update publish-nightly.yml
StaehliJ Jul 25, 2023
d7de538
Fix wrong env var name
StaehliJ Jul 25, 2023
8430127
Merge branch '186-improve-release-ci' of https://github.com/SRGSSR/pi…
StaehliJ Jul 25, 2023
1c009eb
Update publish-nightly.yml
StaehliJ Jul 25, 2023
c0d7507
Add debug CI println
StaehliJ Jul 25, 2023
e8a05e4
Merge branch '186-improve-release-ci' of https://github.com/SRGSSR/pi…
StaehliJ Jul 25, 2023
4e6b10c
Add additional debug infos
StaehliJ Jul 25, 2023
7ed916f
Update publish-nightly.yml
StaehliJ Jul 25, 2023
4723941
Update publish-nightly.yml
StaehliJ Jul 25, 2023
39668f7
Update publish-nightly.yml
StaehliJ Jul 25, 2023
0ca4590
Update release.yml
StaehliJ Jul 25, 2023
2a3f96f
Update publish-nightly.yml
StaehliJ Jul 25, 2023
d555194
Update release.yml
StaehliJ Jul 25, 2023
d2b30df
Update release.yml
StaehliJ Jul 25, 2023
0affb63
cleanup
StaehliJ Jul 25, 2023
e35142d
Remove no more use workflow files
StaehliJ Jul 25, 2023
bd95c92
Merge branch '186-improve-release-ci' of https://github.com/SRGSSR/pi…
StaehliJ Jul 25, 2023
e1c903b
use val for productFlavor (detekt)
StaehliJ Jul 25, 2023
12e31f0
Run test on testProdDebug only
StaehliJ Jul 25, 2023
c7b9fc3
Build prod debug
StaehliJ Jul 25, 2023
344a865
lint only on prod debug
StaehliJ Jul 25, 2023
230b059
Update android-emulator-runner to 2.28
StaehliJ Jul 25, 2023
9ecbd55
Remove useless build before running tests
StaehliJ Jul 25, 2023
58291ec
to version 2.28.0
StaehliJ Jul 25, 2023
efe145d
Fix run test
StaehliJ Jul 25, 2023
45b79bb
Try cache
StaehliJ Jul 25, 2023
9365aae
run test setup java 17
StaehliJ Jul 25, 2023
a464724
remove VERSION file
StaehliJ Jul 25, 2023
517cee6
Fix workflows env github token
StaehliJ Jul 25, 2023
4dbc1a4
Fix release.yml
StaehliJ Jul 25, 2023
4722def
fix release.yml
StaehliJ Jul 25, 2023
8656ba6
use gradle publish to release library
StaehliJ Jul 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Run nightly every nights at midnight or when triggered manually
# https://github.com/orgs/community/discussions/27128
name: Publish demo nightly

on:
workflow_dispatch:
inputs:
version_name:
description: 'version name as xx.yy.zz-Optional'
required: true
type: string
schedule:
- cron: '0 0 * * 1,5'

jobs:
check_date:
runs-on: ubuntu-latest
name: Check latest commit
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}

steps:
- uses: actions/checkout@v3
- name: print latest_commit
run: echo ${{ github.sha }}
- id: should_run
continue-on-error: true
name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> "$GITHUB_OUTPUT"

Build-nightly:
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
runs-on: ubuntu-latest
env:
DEMO_KEY_PASSWORD: ${{ secrets.DEMO_KEY_PASSWORD }}
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: VERSION_NAME from inputs
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "VERSION_NAME=${{ inputs.version_name }}" >> "$GITHUB_ENV"
- name: Find latest tag
if: ${{ github.event_name != 'workflow_dispatch' }}
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1-alpha01 # Optional fallback tag to use when no tag can be found
- name: Setup VERSION_NAME from latest git tag
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
echo "VERSION_NAME=${{ steps.previoustag.outputs.tag }}" >> "$GITHUB_ENV"
- name: Print VersionName
run: |
echo "Version name is ${{ env.VERSION_NAME }}"
echo "ref ${GITHUB_REF}"
echo "refname ${GITHUB_REF_NAME}"
echo "refname ${GITHUB_REF_TYPE}"
echo "CI ${{ env.CI }}"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: assembleNightlyRelease
- name: upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.NIGHTLY_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: ${{ secrets.NIGHTLY_GROUPS }}
file: pillarbox-demo/build/outputs/apk/nightly/release/pillarbox-demo-nightly-release.apk

50 changes: 0 additions & 50 deletions .github/workflows/publish-demo.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/publish-library.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/publish-nightly.yml

This file was deleted.

71 changes: 55 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,58 @@
name: Release Pillarbox
on:
workflow_dispatch:

push:
# Pattern matched against refs/tags
tags:
- '[0-9]+.[0-9].[0-9]'
- '[0-9]+.[0-9].[0-9]-[0-9a-zA-Z]+'
jobs:
PublishRelease:
name: Build and upload library to Github packages
uses: ./.github/workflows/publish-library.yml
with:
isSnapshot: false
secrets: inherit
UploadDemo:
name: Upload Demo to Firebase AppDistribution
uses: ./.github/workflows/publish-demo.yml
secrets:
KEY_PASSWORD: ${{ secrets.DEMO_KEY_PASSWORD }}
FIREBASE_CREDENTIAL_FILE_CONTENT: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
FIREBASE_GROUP: ${{ secrets.RELEASE_GROUPS }}
FIREBASE_APP_ID: ${{ secrets.RELEASE_APP_ID }}
build:
runs-on: ubuntu-latest
env:
DEMO_KEY_PASSWORD: ${{ secrets.DEMO_KEY_PASSWORD }}
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION_NAME: ${{ GITHUB_REF_NAME }}

steps:
- uses: actions/checkout@v3
- name: Check if pre release tag
id: check-tag
run: |
if [[ "${GITHUB_REF_NAME}" =~ [0-9]+.[0-9].[0-9]-[0-9a-zA-Z]+ ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
fi
- name: Print release tag
run: |
echo "tag = ${GITHUB_REF_NAME}"
echo "version_name" = ${{ env.VERSION_NAME }}"
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/[email protected]
with:
arguments: publishProdRelease
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: assembleProdRelease
- name: upload artifact to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.RELEASE_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.FIREBASE_CREDENTIAL_FILE_CONTENT }}
groups: ${{ secrets.RELEASE_GROUPS }}
file: pillarbox-demo/build/outputs/apk/prod/release/pillarbox-demo-prod-release.apk
- name: Create Github release
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: steps.check-tag.outputs.prerelease == 'true'
skipIfReleaseExists: true
generateReleaseNotes: true
22 changes: 0 additions & 22 deletions .github/workflows/snapshot.yml

This file was deleted.

Loading
Loading