diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..46be5e6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Testing Publish Docker image + +on: + pull_request: + branches: [ "main" ] +# release: +# types: [published] + +jobs: + push_to_docker_hub: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: powersjk/pavlov-stats + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + file: ./WebApplication1/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + update_oci_env: + name: Update Oracle Environment + runs-on: ubuntu-latest + env: + OCI_CLI_USER: ${{ secrets.OCI_USER }} + OCI_CLI_TENANCY: ${{ secrets.OCI_TENANCY }} + OCI_CLI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }} + OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_API_KEY }} + OCI_CLI_REGION: ${{ secrets.OCI_REGION }} + + steps: + - name: Retrieve the OCID of a named compartment in tenancy + uses: oracle-actions/run-oci-cli-command@v1.1.1 + id: find-compartment-id + with: + command: 'iam compartment list --compartment-id-in-subtree=true' + query: "data[?name=='${{ secrets.OCI_COMPARTMENT }}'].id" + + - name: Retrieve the display name and shape of the instances in my compartment + uses: oracle-actions/run-oci-cli-command@v1.1.1 + id: find-instances + with: + command: 'compute instance list --compartment-id ${{ steps.find-compartment-id.outputs.raw_output }}' + query: 'data[*].{name: \"display-name\", shape: shape}' + + - name: List the display name and shape of the instances in my compartment + run: | + echo ${{ steps.find-instances.outputs.output }} | jq . + +