fix: fix dockerfile #3
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
name: Build and Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main", "dev"] | |
jobs: | |
build: | |
environment: main | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
runs-on: ubuntu-latest | |
outputs: | |
latest_tag: ${{ steps.set_latest_tag.outputs.latest_tag }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Install musl cc | |
uses: awalsh128/cache-apt-pkgs-action@v1 | |
with: | |
packages: musl-tools musl-dev musl | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: './go.mod' | |
cache: false # Disable built-in caching to use custom caching | |
- name: Tag Version | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GH_ACCESS_TOKEN }} | |
release_branches: main | |
tag_prefix: v | |
- name: Cache Go Modules and Build Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}- | |
${{ runner.os }}-go- | |
- name: Configure Git for Private Repos | |
run: | | |
git config --global url.https://[email protected]/opengovern.insteadOf https://github.com/opengovern | |
- name: Build DigitalOcean Plugin App | |
working-directory: ./steampipe-plugin-digitalocean | |
run: make build | |
- name: Pack DigitalOcean Plugin Build | |
working-directory: ./steampipe-plugin-digitalocean | |
run: | | |
tar -cvf build.tar build | |
- name: Upload DigitalOcean Plugin Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: steampipe-plugin-digitalocean | |
path: ./steampipe-plugin-digitalocean/build.tar | |
retention-days: 1 | |
- name: Build Local Describer App | |
working-directory: . | |
run: make local-build | |
- name: Pack Local Describer Build | |
working-directory: . | |
run: | | |
tar -cvf local.tar local | |
- name: Upload Local Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: local-og-describer-digitalocean | |
path: ./local.tar | |
retention-days: 1 | |
- name: Set Latest Tag Output | |
id: set_latest_tag | |
run: | | |
if [[ -z "${{ steps.tag_version.outputs.new_tag }}" ]]; then | |
echo "latest_tag=${{ steps.tag_version.outputs.previous_tag }}" >> "$GITHUB_OUTPUT" | |
else | |
echo "latest_tag=${{ steps.tag_version.outputs.new_tag }}" >> "$GITHUB_OUTPUT" | |
fi | |
deploy-digitalocean-plugin: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: main | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Download DigitalOcean Plugin Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: steampipe-plugin-digitalocean | |
path: . | |
- name: Unpack DigitalOcean Plugin Artifact | |
run: | | |
tar -xvf build.tar | |
- name: Log in to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_PAT }} | |
- name: Build and Push Docker Image for DigitalOcean Plugin | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/steampipe-plugin-digitalocean:0.0.1 | |
ghcr.io/${{ github.repository_owner }}/steampipe-plugin-digitalocean:${{ needs.build.outputs.latest_tag }} | |
file: steampipe-plugin-digitalocean/docker/Dockerfile | |
context: . | |
deploy-local-describer: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: main | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Download Local Describer Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: local-og-describer-digitalocean | |
path: . | |
- name: Unpack Local Describer Artifact | |
run: | | |
tar -xvf local.tar | |
- name: Log in to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_PAT }} | |
- name: Build and Push Docker Image for Local Describer | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/og-describer-digitalocean:local-latest | |
ghcr.io/${{ github.repository_owner }}/og-describer-digitalocean:local-${{ needs.build.outputs.latest_tag }} | |
file: Dockerfile | |
context: . |