Skip to content

Commit

Permalink
SCALRCORE-21545 > Add step for uploading package to dev registry
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Vang committed May 10, 2022
1 parent 0cdfd61 commit 732f692
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/default.yml
Expand Up @@ -70,6 +70,46 @@ jobs:
with:
command: delete
container_id: ${{ steps.create.outputs.container_id }}
upload-dev:
name: upload-dev
needs: [lint, unit-tests, acc-tests]
runs-on: ubuntu-latest
steps:
- name: Import GPG key
id: import_gpg
uses: Scalr/ghaction-import-gpg@v2.1.1
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.17"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Upload provider to registry
env:
DOMAIN: registry.scalr.dev
BUCKET_NAME: gs://tf-registry-48e84b05eab87d56
GPG_KEY_ID: ${{ steps.import_gpg.outputs.fingerprint }}
GPG_PUB_KEY: ${{ steps.import_gpg.outputs.pubkey }}
run: bash scripts/upload.sh
release:
name: release
if: startsWith(github.ref, 'refs/tags/')
Expand Down
8 changes: 7 additions & 1 deletion scripts/upload.sh
Expand Up @@ -10,8 +10,14 @@ PROVIDER_SOURCE="scalr/scalr"
URL="https://$DOMAIN"
PROTOCOLS="[\"5.0\"]"

# If tag is not defined, use branch name as version
VERSION=$(PAGER= git tag --points-at HEAD)
VERSION=${VERSION:1}
if [ -z "$VERSION" ]; then
VERSION=$(git rev-parse --abbrev-ref HEAD | sed 's|\(.*\)|\L\1|g;s|/|-|g')
else
VERSION=${VERSION:1}
fi

TMP_DIR=$(mktemp -d -t scalr-provider-$VERSION-XXXXXXXXXXX)
PROVIDER_BIN_PATH=$TMP_DIR/$PROVIDER_NAME/$VERSION
DOWNLOAD_DIR=$TMP_DIR/$PROVIDER_SOURCE/$VERSION/download/
Expand Down

0 comments on commit 732f692

Please sign in to comment.