-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from basedosdados/chore/update-gh-actions
chore: update deployment workflows to use fixed branch references
- Loading branch information
Showing
5 changed files
with
5 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ on: | |
workflows: [Release Image (Development)] | ||
branches: [dev] | ||
types: [completed] | ||
workflow_dispatch: | ||
jobs: | ||
deploy-dev: | ||
runs-on: ubuntu-latest | ||
|
@@ -16,42 +15,10 @@ jobs: | |
name: development | ||
url: https://api.development.basedosdados.org | ||
steps: | ||
- name: Download branch name | ||
uses: actions/github-script@v6 | ||
if: ${{ github.event_name == 'workflow_run' }} | ||
with: | ||
script: | | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "branch" | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifact.zip`, Buffer.from(download.data)); | ||
- name: Extract branch name | ||
if: ${{ github.event_name == 'workflow_run' }} | ||
run: unzip artifact.zip | ||
- name: Read branch name | ||
id: extract_branch | ||
run: | | ||
if [ ! -f "branch" ]; then | ||
echo "branch=main" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "branch=$(cat branch)" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ steps.extract_branch.outputs.branch }} | ||
ref: dev | ||
- name: Import secrets from Vault | ||
id: import_secrets | ||
uses: hashicorp/[email protected] | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
ref: staging | ||
- name: Import secrets from Vault | ||
id: import_secrets | ||
uses: hashicorp/[email protected] | ||
|
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
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