Skip to content

Commit

Permalink
all in one remote
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Aug 27, 2024
1 parent 3a0c3a4 commit 0118d41
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ inputs:
commitMessage:
description: 'Message for Package.swift commit'
required: true
tagMessage:
description: 'Message for release tag'
required: true
tagVersion:
description: 'The release version'
required: true
remoteRepo:
description: 'Remote repo [org]/[repo]'
required: true
Expand Down
7 changes: 5 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as fs from 'fs'
export async function run(): Promise<void> {
try {
const commitMessage: string = core.getInput('commitMessage')
const tagMessage: string = core.getInput('tagMessage')
const tagVersion: string = core.getInput('tagVersion')
const remoteRepo: string = core.getInput('remoteRepo')
let remoteRepoUrl: string = core.getInput('remoteRepoUrl')
const localPackagePath: string = core.getInput('localPackagePath')
Expand All @@ -22,8 +24,6 @@ export async function run(): Promise<void> {

const git = simpleGit()

await git.pull()

await git.raw('fetch', remoteRepoUrl, remoteBranch)

await git.raw('branch', 'remote_swift_package', 'FETCH_HEAD')
Expand All @@ -33,10 +33,11 @@ export async function run(): Promise<void> {
fs.writeFileSync(`.git/tmp/remote_swift_package${remotePackagePath}/Package.swift`, packageSource);

Check failure on line 33 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Replace ``.git/tmp/remote_swift_package${remotePackagePath}/Package.swift`,·packageSource);` with `⏎······`.git/tmp/remote_swift_package${remotePackagePath}/Package.swift`,⏎······packageSource⏎····)`

Check failure on line 33 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Extra semicolon

const worktreeGit = simpleGit('.git/tmp/remote_swift_package')
await worktreeGit.pull() // Get release tag
await worktreeGit.add('.')
await worktreeGit.commit(commitMessage)

await worktreeGit.raw('push', remoteRepoUrl, `remote_swift_package:${remoteBranch}`)
await worktreeGit.raw('tag', '-fa', tagVersion, '-m', tagMessage)
await worktreeGit.raw('push', '--follow-tags', remoteRepoUrl, `remote_swift_package:${remoteBranch}`)

Check failure on line 40 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Replace `'push',·'--follow-tags',·remoteRepoUrl,·`remote_swift_package:${remoteBranch}`` with `⏎······'push',⏎······'--follow-tags',⏎······remoteRepoUrl,⏎······`remote_swift_package:${remoteBranch}`⏎····`
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
Expand Down

0 comments on commit 0118d41

Please sign in to comment.