Skip to content

Commit

Permalink
Use secrets-packer (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
suzulabo authored Dec 31, 2021
1 parent 9c33cdb commit f1d1dd4
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-firebase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:

- uses: ./.github/workflows/build-setup
with:
SECRET_VALUES: ${{ secrets.SECRET_VALUES }}
SECRET_PACKED: ${{ secrets.SECRET_PACKED }}
SECRET_PACKED_SIGN: ${{ secrets.SECRET_PACKED_SIGN }}
id: build_setup

- run: npm run - firebase.deploy
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
inputs:
SECRET_VALUES:
SECRET_PACKED:
required: true
SECRET_PACKED_SIGN:
required: true

outputs:
Expand Down Expand Up @@ -31,7 +33,8 @@ runs:
- run: npm run - secrets.unpack
shell: bash
env:
SECRET_VALUES: ${{ inputs.SECRET_VALUES }}
SECRET_PACKED: ${{ inputs.SECRET_PACKED }}
SECRET_PACKED_SIGN: ${{ inputs.SECRET_PACKED_SIGN }}
id: unpack_secrets

- run: npm run - secrets.copy
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ AppleDistribution.p12

release.keystore

SECRET_VALUES.txt
.secrets-sign.json
PACKED.txt


/firebase/*.log
Expand Down
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@stencil/core": "2.9.0",
"@stencil/sass": "1.5.2",
"@stencil/store": "1.5.0",
"@suzulabo/secrets-packer": "0.0.1",
"ajv": "8.8.1",
"ajv-formats": "2.1.1",
"autolinker": "3.14.3",
Expand Down
10 changes: 4 additions & 6 deletions scripts/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Cmd, main, RunP, RunS, ScriptEntries } from '@suzulabo/ttscripts';
import { startDevProxy } from './dev-proxy/dev-proxy';
import { buildFunctions, buildFunctionsWatch } from './functions/build';
import { copySecrets } from './secrets/copy';
import { packSecrets } from './secrets/pack';
import { unpackSecrets } from './secrets/unpack';
import { secrets } from './secrets';
import { checkUnusedExports } from './unused-exports/check';

const entries: ScriptEntries = [
Expand Down Expand Up @@ -75,9 +73,9 @@ const entries: ScriptEntries = [
['client.cap.dev.update', RunS(['client.cap.build.dev', 'client.cap.copy'])],

// secrets
['secrets.copy', copySecrets],
['secrets.pack', packSecrets],
['secrets.unpack', unpackSecrets],
['secrets.copy', secrets.copy],
['secrets.pack', secrets.pack],
['secrets.unpack', secrets.unpack],

// dev-proxy
['dev-proxy.start', startDevProxy],
Expand Down
39 changes: 39 additions & 0 deletions scripts/secrets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { copySecrets, packSecrets, SecretsConfig, unpackSecrets } from '@suzulabo/secrets-packer';

const config: SecretsConfig = {
files: [
['App.entitlements', 'capacitor/client/ios/App/App'],
['GoogleService-Info.plist', 'capacitor/client/ios/App/App'],
['google-services.json', 'capacitor/client/android/app'],
['.firebaserc', 'firebase'],
['docs-vars.json', 'firebase/docs'],
['appenv.env.ts'],
['android.custom.properties'],
['apple-app-site-association'],
['assetlinks.json'],

['AppleDistribution.p12'],
['Ad_Hoc.mobileprovision'],
['Release.mobileprovision'],

['release.keystore'],
],
secretsJSONKeys: [
'APPSTORE_API_KEY',
'APPSTORE_API_ISSUER',
'FIREBASE_APP_ID_IOS',
'FIREBASE_APP_ID_ANDROID',
],
};

export const secrets = {
pack: () => {
return packSecrets(config);
},
unpack: () => {
return unpackSecrets(config);
},
copy: () => {
return copySecrets(config);
},
};

0 comments on commit f1d1dd4

Please sign in to comment.